@Test public void testFromBytes() { int randomTime = ThreadLocalRandom.current().nextInt(); int randomMachineId = ThreadLocalRandom.current().nextInt(0, 16777215); short randomProcessId = (short) ThreadLocalRandom.current().nextInt(0, Short.MAX_VALUE); int randomCounter = ThreadLocalRandom.current().nextInt(0, 16777215); GradoopId expectedId = new GradoopId(randomTime, randomMachineId, randomProcessId, randomCounter); byte[] bytes = new byte[GradoopId.ID_SIZE]; ByteBuffer buffer = ByteBuffer.wrap(bytes); buffer.putInt(randomTime); byte b1; byte b2; byte b3; b3 = (byte) (randomMachineId & 0xFF); b2 = (byte) ((randomMachineId >> 8) & 0xFF); b1 = (byte) ((randomMachineId >> 16) & 0xFF); buffer.put(b1); buffer.put(b2); buffer.put(b3); buffer.putShort(randomProcessId); b3 = (byte) (randomCounter & 0xFF); b2 = (byte) ((randomCounter >> 8) & 0xFF); b1 = (byte) ((randomCounter >> 16) & 0xFF); buffer.put(b1); buffer.put(b2); buffer.put(b3); GradoopId newId = GradoopId.fromByteArray(bytes); assertEquals(expectedId, newId); }
public static GradoopId fromByteArray(byte[] bytes) { return new GradoopId(bytes); }
GradoopId implements NormalizableKey<GradoopId>, CopyableValue<GradoopId> { public static GradoopId fromByteArray(byte[] bytes) { return new GradoopId(bytes); } }
GradoopId implements NormalizableKey<GradoopId>, CopyableValue<GradoopId> { public static GradoopId fromByteArray(byte[] bytes) { return new GradoopId(bytes); } GradoopId(); private  GradoopId(byte[] bytes);  GradoopId(final int timestamp, final int machineIdentifier,
    final short processIdentifier, final int counter); private  GradoopId(final int timestamp, final int machineIdentifier, final short processIdentifier,
    final int counter, final boolean checkCounter); }
GradoopId implements NormalizableKey<GradoopId>, CopyableValue<GradoopId> { public static GradoopId fromByteArray(byte[] bytes) { return new GradoopId(bytes); } GradoopId(); private  GradoopId(byte[] bytes);  GradoopId(final int timestamp, final int machineIdentifier,
    final short processIdentifier, final int counter); private  GradoopId(final int timestamp, final int machineIdentifier, final short processIdentifier,
    final int counter, final boolean checkCounter); static GradoopId get(); static GradoopId fromString(String string); static boolean isValid(final String hexString); static GradoopId fromByteArray(byte[] bytes); byte[] toByteArray(); @Override boolean equals(Object o); @Override int hashCode(); @Override int compareTo(GradoopId other); @Override String toString(); @Override int getMaxNormalizedKeyLen(); @Override void copyNormalizedKey(MemorySegment target, int offset, int len); @Override void write(DataOutputView out); @Override void read(DataInputView in); @Override int getBinaryLength(); @Override void copyTo(GradoopId target); @Override GradoopId copy(); @Override void copy(DataInputView source, DataOutputView target); static GradoopId min(GradoopId first, GradoopId second); }
GradoopId implements NormalizableKey<GradoopId>, CopyableValue<GradoopId> { public static GradoopId fromByteArray(byte[] bytes) { return new GradoopId(bytes); } GradoopId(); private  GradoopId(byte[] bytes);  GradoopId(final int timestamp, final int machineIdentifier,
    final short processIdentifier, final int counter); private  GradoopId(final int timestamp, final int machineIdentifier, final short processIdentifier,
    final int counter, final boolean checkCounter); static GradoopId get(); static GradoopId fromString(String string); static boolean isValid(final String hexString); static GradoopId fromByteArray(byte[] bytes); byte[] toByteArray(); @Override boolean equals(Object o); @Override int hashCode(); @Override int compareTo(GradoopId other); @Override String toString(); @Override int getMaxNormalizedKeyLen(); @Override void copyNormalizedKey(MemorySegment target, int offset, int len); @Override void write(DataOutputView out); @Override void read(DataInputView in); @Override int getBinaryLength(); @Override void copyTo(GradoopId target); @Override GradoopId copy(); @Override void copy(DataInputView source, DataOutputView target); static GradoopId min(GradoopId first, GradoopId second); static final int ID_SIZE; static final GradoopId NULL_VALUE; }