/** * Create instance from the eight bytes starting at offset. * @param bytes the bytes to store as a ZipEightByteInteger * @param offset the offset to start */ public ZipEightByteInteger(byte[] bytes, int offset) { value = ZipEightByteInteger.getValue(bytes, offset); }
/** * Helper method to get the value as a Java long from an eight-byte array * @param bytes the array of bytes * @return the corresponding Java BigInteger value */ public static BigInteger getValue(byte[] bytes) { return getValue(bytes, 0); }
/** * Override to make two instances with same value equal. * @param o an object to compare * @return true if the objects are equal */ @Override public boolean equals(Object o) { return o instanceof ZipEightByteInteger && value.equals(((ZipEightByteInteger) o).getValue()); }
/** * Helper method to get the value as a Java long from eight bytes * starting at given array offset * @param bytes the array of bytes * @param offset the offset to start * @return the corresponding Java long value */ public static long getLongValue(byte[] bytes, int offset) { return getValue(bytes, offset).longValue(); }