Skip to content

Instantly share code, notes, and snippets.

@diaolizhi
Created September 29, 2018 12:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diaolizhi/a86c114bf8b624a5b3088f9dcf21617f to your computer and use it in GitHub Desktop.
Save diaolizhi/a86c114bf8b624a5b3088f9dcf21617f to your computer and use it in GitHub Desktop.
打印整数的二进制数
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