We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 19545ce commit 2dc208eCopy full SHA for 2dc208e
1 file changed
binary
@@ -0,0 +1,23 @@
1
+public class Solution {
2
+
3
+ public String findDigitsInBinary(int a) {
4
5
+ StringBuilder binary = new StringBuilder();
6
+ String s;
7
+ if(a==0)
8
+ { s="0";
9
10
+ return s; }
11
12
+while (a>0) {
13
+ if((a&1)==1){
14
+ binary.append(1);
15
+ }else
16
+ binary.append(0);
17
+ a>>=1;
18
+}
19
+binary.reverse();
20
+ s= binary.toString();
21
+return s;
22
23
0 commit comments