进制转换,十进制转为二进制、八进制、十六进制
package wzt;
public class Bit1 {
public static void main(String[] args) {
int i=255;
System.out.println(i);
System.out.println(Integer.toBinaryString(i));//10转2
System.out.println(Integer.toOctalString(i));//10转8
System.out.println(Integer.toHexString(i));//10转16+
System.out.println(0b11111111);//2转10
System.out.println(010);//8转10
System.out.println(0xff);//16转10
System.out.println(0b101);//2转10
共有 0 条评论