KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > T3102re1


1
2 class T3102re1 {
3     public static void main(String JavaDoc[] args) {
4         double d1 = Double.longBitsToDouble(0x3ff8000000000000L);
5         double d2 = Double.longBitsToDouble(0x000000003ff80000L);
6         // compare d1 and d2, to make sure endianness of longs
7
// was not wrong, either
8
if (d1 == 1.5 && d1 > d2) {
9             System.out.print("OK");
10         } else if (d2 == 1.5 || d1 < d2) {
11             System.out.print("Wrong endianness");
12         } else {
13             System.out.print("Unexpected result");
14         }
15     }
16 }
17     
Popular Tags