진수변환 3

[Java] 자바 진수변환 알고리즘

10진수->2/8/16진수 Integer.toBinaryString(바꿀문자열); Integer.toOctalString(바꿀문자열); Integer.toHexString(바꿀문자열); int i = 127; String binaryString = Integer.toBinaryString(i); //2진수 String octalString = Integer.toOctalString(i); //8진수 String hexString = Integer.toHexString(i); //16진수 System.out.println(binaryString); //1111111 System.out.println(octalString); //177 System.out.println(hexString); //7f 2/8/..

(2018카카오) n진수 게임 Java

실제로 존재하는 술게임이다..;; 진수변환에 관한 문제이다. 10~15는 각각 대문자 A~F로 출력한다. String[] alphaForMoreThanTen = {"A","B","C","D","E","F"}; 위와 같이 ABCDEF 사전을 만들어놓고, 아래와 같이 나머지값이 10~15인 값에 대하여 대체텍스트를 대입한다. if(remain>=10&&remain=10&&remain2/8/16진수 Integer.toBinaryString(바꿀문자열); Integer.toOctalString(바꿀문자열); Integer.toHexString(바꿀문자열); int i = 127; String binaryString = Integer.toBinaryString(i); //2진수 Strin.. skmouse.tis..

(2018 카카오) [1차] 비밀지도 Java

Java에서 10진수를 2진수로 변환하는 방법이 포함되어있다. 위 진수변환 관련 내용은 아래 글 참고. donggov.tistory.com/48 자바 10진수 2진수, 8진수, 16진수 변환 자바 2진수, 8진수, 16진수 변환 시에는 Integer 클래스 API를 활용하면 편하다. (참고 : https://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html) 10진수 -> 2진수, 8진수, 16진수 변환 1 2 3 4 5 6.. donggov.tistory.com String 이진수 = Integer.toBinaryString(십진수값); 아래는 본인의 코드이다. class Solution { public String[] solution(int n, i..