java Binary decimal, hexadecimal (hex various conversion).

 

. 1 Key = "1111" ;
 2  // the binary string key, transformed into decimal Keys 
. 3 Keys = the Integer.parseInt (key, 2); // numeral 2 a band, may be various ary , converted to decimal 
. 4  System.out.println (keys);
 . 5  // the switch keys 10 hexadecimal to hexadecimal result, toUpperCase () is the lowercase to uppercase 
. 6 Result = Integer.toHexString (keys ) .toUpperCase ();
 . 7 System.out.println (Result);

 

Guess you like

Origin www.cnblogs.com/mengweihong/p/11305006.html