Created
May 4, 2013 17:11
-
-
Save aeg/5518112 to your computer and use it in GitHub Desktop.
10進数を2進数、8進数、16進数、n進数に変換する。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Case #1 | |
// 10進数を16進数にする | |
assert Integer.toHexString(129) == '81' | |
// Case #2 | |
// 10進数を2進数にする | |
assert Integer.toBinaryString(129) == '10000001' | |
// Case #3 | |
// 10進数を8進数にする | |
assert Integer.toOctalString(129) == '201' | |
// Case #4 | |
// 10進数をn進数にする(以下では、n=7の例) | |
assert Integer.toString(129, 7) == '243' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment