Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
binary
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]){ System.out.println(getbinary(5));; } public static int getbinary(int input){ String binary=""; for (int i = input; i > 0; i=i/2) { binary = i%2 + binary; } return Integer.parseInt(binary); } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
상속1
AllStar
Validate BST
output2
H
binary square root
2c
3e
Factorial using recursion in java
Find Median in Large File of Integers
Please log in to post a comment.