Skip to content

Instantly share code, notes, and snippets.

@ChicagoDev
Created February 16, 2023 14:24
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 ChicagoDev/2b35d218f4d1615d112c5e077abbfc56 to your computer and use it in GitHub Desktop.
Save ChicagoDev/2b35d218f4d1615d112c5e077abbfc56 to your computer and use it in GitHub Desktop.
public void function(int N) {
Stack<Integer> stack = new Stack<Integer>();
while (N > 0) {
stack.push(N % 2);
N = N / 2;
}
for (int b: stack) {StdOut.print(b);}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment