clcommon/src/main/java/ucar/nc2/iosp/gini/Giniheader.java
private double readScaledInt(ByteBuffer buf) {
    // Get the first two bytes
    short s1 = buf.getShort();

    // And the last one as unsigned
    short s2 = DataType.unsignedByteToShort(buf.get());

    // Get the sign bit, converting from 0 or 2 to +/- 1.
    int posneg = 1 - ((s1 & 0x8000) >> 14);

    // Combine the first two bytes (without sign bit) with the last byte.
    // Multiply by proper factor for +/-
    int nn = (((s1 & 0x7FFF) << 8) | s2) * posneg;
    return (double) nn / 10000.0;
  }
private double readScaledInt(ByteBuffer buf) {
    // Get the first two bytes
    short s1 = buf.getShort();

    // And the last one as unsigned
    short s2 = DataType.unsignedByteToShort(buf.get());

    // Get the sign bit, converting from 0 or 2 to +/- 1.
    int posneg = 1 - ((s1 & 0x8000) >> 14);

    // Combine the first two bytes (without sign bit) with the last byte.
    // Multiply by proper factor for +/-
    int nn = (((s1 & 0x7FFF) << 8) | s2) * posneg;
    return (double) nn / 10000.0;
  }
private double readScaledInt ( ByteBuffer buf ) { // Get the first two bytes short s1 = buf . getShort ( ) ; // And the last one as unsigned short s2 = DataType . unsignedByteToShort ( buf . get ( ) ) ; // Get the sign bit, converting from 0 or 2 to +/- 1. int posneg = 1 - ( ( s1 & 0x8000 ) >> 14 ) ; // Combine the first two bytes (without sign bit) with the last byte. // Multiply by proper factor for +/- int nn = ( ( ( s1 & 0x7FFF ) << 8 ) | s2 ) * posneg ; return ( double ) nn / 10000.0 ; }
Read a scaled, 3-byte integer from file and convert to double
Read a scaled 3 - byte integer from file and convert to double