AAA.java 1.41 KB
package com.bootdo.common.utils;

import java.util.HashMap;
import java.util.Map;

public class AAA {

	
	
	public static void main(String[] args) {
		
    	//map打印
    	Map<String,Object> map = new HashMap<String,Object>();
    	map.put("name", "zhangsan");
    	map.put("age", 21);
    	
    	for(int i=0;i<20;i++) {
    		map.put(String.valueOf(i), i+"aa");
    	}

    	System.out.println(map.toString());
    	Map<String,Object> map2 = new HashMap<String, Object>();
    	map2.put("ss", map.toString());
    	System.out.println(map2.get("ss"));
    	
    	System.out.println("13".hashCode());
    	System.out.println("14".hashCode());
    	
    	int hash = 0;
    	char value[] = {'1','4'};
        int h = hash;
        if (h == 0 && value.length > 0) {
            char val[] = value;

            for (int i = 0; i < value.length; i++) {
                h = 31 * h + val[i];
            }
            hash = h;
        }
        System.out.println(h);

        
    	char value2[] = {'4','1'};
    	int h2 = hash;
        if (h2 == 0 && value2.length > 0) {
            char val[] = value2;

            for (int i = 0; i < value2.length; i++) {
                h2 = 31 * h2 + val[i];
            }
            hash = h2;
        }
        System.out.println(h2);
        
        System.out.println("14".hashCode());
        System.out.println("41".hashCode());
        
	}
}