Created
September 29, 2018 12:04
-
-
Save diaolizhi/a86c114bf8b624a5b3088f9dcf21617f to your computer and use it in GitHub Desktop.
打印整数的二进制数
This file contains 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
Stack<Integer> stack = new Stack<Integer>(); | |
while(N > 0) { | |
stack.push(N % 2); | |
N = N / 2; | |
} | |
for(int d : stack) { | |
System.out.print(d); | |
} | |
System.out.println(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment