import java.util.*;
public class Main17 {
/**
*
*/
public static void main(String[] args) {
test();
}
/**
* 反轉二進制數並輸出結果的十進制值是多少
*/
public static void test() {
int d =8;
int len = Integer.toBinaryString(d).length(); //十進制轉化爲二進制
System.out.println(Integer.toBinaryString(d));
StringBuffer sb=new StringBuffer();
int index = 0;
while (d != 0) { //將二進制反轉
sb.append(d & 0x01);
d >>= 1;
}
String str=sb.toString();
String str1=Integer.valueOf(str,2).toString();//二進制轉化爲十進制
System.out.println(str1);
}
}