2

I am generating sequence of numbers of type double like 0.9913963644564902 0.0341175990344773 0.13181105852355268 0.45773616980747556 and I have to convert it to binary representation in java.

Kailash
  • 642
  • 2
  • 9
  • 15

1 Answers1

2

This will help you. I have tried out using one of your input double value - 0.9913963644564902

 public static void main(String[] args){
        double d = 0.9913963644564902;
        System.out.println("0b"+Long.toBinaryString(Double.doubleToRawLongBits(d)));
    }

The output would be

run:
0b11111111101111101110011000010011011110010101101101100001110011
BUILD SUCCESSFUL (total time: 0 seconds)
Keerthivasan
  • 12,760
  • 2
  • 32
  • 53