本帖最后由 my_android_drea 于 2014-3-24 00:48 编辑
- public class Shiliu{
- public static void getshiliu(int a)
- {
- StringBuffer sb=new StringBuffer();
-
- for(;a>0;a=a>>>4)
- {
- int x=a&15;
-
- if(x>9)
- sb.append((char)(x-10+'A'));
- else
- sb.append(x);
-
- }
- System.out.println(sb.reverse()); // 先装到容器里面,再反向打印
- }
- public static void main(String[] args){
- int n=165695845;
- getshiliu(n);
-
- }
- }
复制代码 |