public static double bytesToDouble(byte[] b){
  if (b == null) {
    return Double.NaN;
  }
  DataInputStream dis=new DataInputStream(new ByteArrayInputStream(b));
  try {
    if (b.length == 4) {
      return dis.readFloat();
    }
 else {
      return dis.readDouble();
    }
  }
 catch (  IOException bad) {
    return Double.NaN;
  }
}

public static double bytesToDouble ( byte [ ] b ) { if ( b == null ) { return Double . NaN ; } DataInputStream dis = new DataInputStream ( new ByteArrayInputStream ( b ) ) ; try { if ( b . length == 4 ) { return dis . readFloat ( ) ; } else { return dis . readDouble ( ) ; } } catch ( IOException bad ) { return Double . NaN ; } }
decodes byte array to a double value .
