convert decimal number including decimal point to binary number in java : <p>//I want to make a program to make binary number using the following programs.
//But I can use only  "for" and "if" .</p>

<pre><code>public class Name {
    public static void main(String[] args) {
        double x =Math.PI-3;
        int t;
        for(t=0;t&lt;=19;t++){
            System.out.print(x+"\t");
            if(x&lt;0.5){
               x=2*x;
           }
            else{
                x=2*x-1;
        }
            System.out.print(x);
        }
    }
</code></pre>

<p>}</p>
