Java数值转化为二进制、十进制、十六进制字符串

int i = 123;
String binStr = Integer.toBinaryString(i); String otcStr = Integer.toOctalString(i); String hexStr = Integer.toHexString(i); String str = Integer.toBinaryString(i); String reverseStr = new StringBuilder(str).reverse().toString(); if (reverseStr.charAt(0) == '1') {   System.out.println('True') }

 

posted on 2013-10-10 20:15  Xavierr  阅读(490)  评论(0编辑  收藏  举报