Revert "BAEL-4134"

This commit is contained in:
Loredana Crusoveanu
2020-07-07 14:18:10 +03:00
committed by GitHub
parent 4a35b97bad
commit 7ab2f437ee
2466 changed files with 9477 additions and 479200 deletions
@@ -0,0 +1,17 @@
package com.baeldung.integerToBinary;
public class IntegerToBinary {
public static String convertIntegerToBinary(int n) {
if(n == 0) {
return "0";
}
StringBuilder binaryNumber = new StringBuilder();
while (n > 0) {
int remainder = n % 2;
binaryNumber.append(remainder);
n /= 2;
}
binaryNumber = binaryNumber.reverse();
return binaryNumber.toString();
}
}