java 4 decimal place for binary
<p>how can i make sure that the converted binary from int is displayed in 4,8,12... decimal place?</p>

<p>like</p>

<pre><code>0000
0001
0010
0011
0100
0101
0110
</code></pre>

<p>Pls advice..</p>

<pre><code>public int binary(int n)
{

if (add &gt; 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);
}
</code></pre>
