public class App {
public static void main( String[] args ) {
int i = 192;
System.out.println("---------------------------------");
System.out.println("十进制转二进制:" + Integer.toBinaryString(i));
System.out.println("十进制转八进制:" + Integer.toOctalString(i));
System.out.println("十进制转十六进制:" + Integer.toHexString(i));
System.out.println("---------------------------------");
System.out.println("二进制转十进制:" + Integer.valueOf("11000000", 2).toString());
System.out.println("八进制转十进制:" + Integer.valueOf("300", 8).toString());
System.out.println("十六进制转十进制:" + Integer.valueOf("c0", 16).toString());
System.out.println("---------------------------------");
}
}
网友评论