Exemple #1
0
 @Override
 public long asLong() {
   Preconditions.checkState(
       this.bytes.length >= 8,
       "HashCode#asLong() requires >= 8 bytes (it only has %s bytes).",
       this.bytes.length);
   return this.padToLong();
 }
Exemple #2
0
 @Override
 public int asInt() {
   Preconditions.checkState(
       this.bytes.length >= 4,
       "HashCode#asInt() requires >= 4 bytes (it only has %s bytes).",
       this.bytes.length);
   return (this.bytes[0] & 0xFF)
       | (this.bytes[1] & 0xFF) << 8
       | (this.bytes[2] & 0xFF) << 16
       | (this.bytes[3] & 0xFF) << 24;
 }