Back-end/JAVA
JAVA 진법변환 출력
1924
2021. 12. 21. 05:53
public class Main {
public static void main(String[] args) {
int a = 200;
System.out.println("10진수 : " + a);
System.out.format("8진수 : %o\n", a);
System.out.format("16진수 : %x", a);
}
}
System.out.format을 사용하여 8진수는 %o, 16진수는 %x로 출력한다.