how can i make sure that the converted binary from int is displayed in 4,8,12… decimal place?
like
0000
0001
0010
0011
0100
0101
0110
Pls advice..
public int binary(int n)
{
if (add > count)
{
System.out.println("break");
return 0;
}
else
{
sb=Integer.toBinaryString(add);
num = Integer.parseInt(sb);
add++;
}
while (sb.length()%2==0)
{ temp = sb;
sb = "";
sb = "0" + temp;
}
System.out.println(sb);
return binary(add);
}
is this what you want?