Decimal to Binary
A Decimal to Binary conversion algorithm implementation.
public static String binary(int input){
StringBuilder builder = new StringBuilder();
int numerator = input;
while(true){
int divisor = numerator/2;
int remainder = numerator%2;
builder.append(remainder+"");
numerator = divisor;
if(divisor==1){
builder.append("1");
break;
}else if(divisor==0){
builder.append("0");
break;
}
}
return builder.reverse().toString();
}