Binary Decimal turn
public String tenTotwo(int N) {
String str = "";
int x = N;
int y = 0;
while(x != 0){
y = x % 2;
x = x / 2;
str = y + str;
}
return str;
}
Binary Coded Decimal
public int twoToten(String two) {
int n = 0;
int j = 1;
for(int i = two.length() - 1; i >= 0; i--){
int x = two.charAt(i) - 48;
n = n + x * j;
j = j * 2;
}
return n;
}