Packagecom.simope.myTest;ImportJava.util.HashMap;ImportJava.util.Iterator;ImportJava.util.Map; Public classTest20151026 { Public Static voidMain (string[] args) {//the multiplication method is best to use the shift operation, the efficiency is fast//shift left two-100000//shift right Three-1System.out.println ("8 << 2:" + (8 << 2)); System.out.println ("8 >> 3:" + (8 >> 3)); System.out.println (">>> 3:" + (>>> 3)); System.out.println ("***********************************"); intA = one, B = 17;//two operand median is 1, the result is 1, otherwise the result is 0 11:1011, 17:10001, 1:1System.out.println ("A & B:" + (A &b)); //two bits as long as there is a 1, then the result is 1, otherwise 0 11:1011, 17:10001-11011:27System.out.println ("a | B: "+ (A |b)); //if the bit is 0, the result is 1, if the bit is 1, the result is 0 11:1011-0100System.out.println ("~a:" + (~a)); //two operand bits, same result is 0, different result is 1 11:1011, 17:10001-11010:26System.out.println ("A^b:" + (a ^b)); System.out.println ("***********************************"); //This traversal is the most efficient method for map traversalmap<string, object> map =NewHashmap<string, object>(); Map.put ("Name", "Zhang San"); Map.put ("Age", "21"); Map.put ("Sex", "man"); Map.put ("Scholl", "Hbut"); Iterator<map.entry<string, object>> iter =Map.entryset (). iterator (); while(Iter.hasnext ()) {Map.entry<string, object> entry =Iter.next (); System.out.println ("Key:" + entry.getkey () + "value:" +Entry.getvalue ()); } System.out.println ("***********************************"); } }
The Java operator