Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (int j=0;j<3;j++){
- byte testing2[] = new byte[8];
- raf.read(testing2,0,8);
- for(int i=0;i<8;i++){
- System.out.print(testing2[i]);}
- double testing2double = DataReader.bytesToDouble(testing2);
- System.out.println(testing2double);
- }
- //Function that is called:
- public static double bytesToDouble (byte[] bytes){
- byte doubles[] = new byte[8];
- for(int i=7,j=0;i>-1&&j<8;i--,j++){
- doubles[j]=bytes[i];}
- return ByteBuffer.wrap(doubles).getDouble();
- }
- /* INPUT (from data stored in the Binary file)
- * 01 00 00 9A 99 99 99 99 95 72 40 48 E1 7A 14 AE 87 37 40 9D B7 C0 03 3B
- */
- /* OUTPUT (Spaces added for clarity)
- * 1 0 0 -102 -103 -103 -103 -103 -2.353437370456345E-185
- * -107 114 64 72 -31 122 20 -82 -1.02951151960672E-86
- * -121 55 64 -99 -73 -64 3 59 2.0423918294647677E-24
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement