Print
카테고리: [ Development ]
조회수: 5740

1. 소개


2. 코드

StringBuffer deciFormat = new StringBuffer();
for ( int inx=0; inx<n; inx++ ) {
  deciFormat.append("0");
}
 
System.out.println(i);
String s1 = Integer.toBinaryString(i);
System.out.println(s1);
DecimalFormat df = new DecimalFormat(deciFormat.toString());
String s2 = df.format(Integer.parseInt(s1));
System.out.println(s2);

3. 결과

9
1001
01001