进制之间的转换

来源:互联网 发布:linux hostname命令 编辑:程序博客网 时间:2024/05/19 06:47
//进制之间转换    @Test    public void testBinary() {        int i = 111;        String str = Integer.toBinaryString(i);        String str16 = Integer.toHexString(i);        String str8 = Integer.toOctalString(i);        Integer in = Integer.parseInt(str);        System.out.println(in);        System.out.println(str8);        System.out.println(str16);        int no = Integer.parseInt(str, 2);        System.out.println(no);    }
0 0
原创粉丝点击