@Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionForIntLargerThanMaxUnsignedShort() { final int int1 = (1 << 16); final int int2 = 32234; final int int3 = 12231; final int int4 = 65000; ByteUtil.packLongWithUnsignedShortInts(int1, int2, int3, int4); }
public static long packLongWithUnsignedShortInts(final int int1, final int int2, final int int3, final int int4) { checkUnsignedShort(int1); checkUnsignedShort(int2); checkUnsignedShort(int3); checkUnsignedShort(int4); return ((int1 & 0xFFFFL) << 48) + ((int2 & 0xFFFFL) << 32) + ((int3 & 0xFFFFL) << 16) + (int4 & 0xFFFFL); }
ByteUtil { public static long packLongWithUnsignedShortInts(final int int1, final int int2, final int int3, final int int4) { checkUnsignedShort(int1); checkUnsignedShort(int2); checkUnsignedShort(int3); checkUnsignedShort(int4); return ((int1 & 0xFFFFL) << 48) + ((int2 & 0xFFFFL) << 32) + ((int3 & 0xFFFFL) << 16) + (int4 & 0xFFFFL); } }
ByteUtil { public static long packLongWithUnsignedShortInts(final int int1, final int int2, final int int3, final int int4) { checkUnsignedShort(int1); checkUnsignedShort(int2); checkUnsignedShort(int3); checkUnsignedShort(int4); return ((int1 & 0xFFFFL) << 48) + ((int2 & 0xFFFFL) << 32) + ((int3 & 0xFFFFL) << 16) + (int4 & 0xFFFFL); }  }
ByteUtil { public static long packLongWithUnsignedShortInts(final int int1, final int int2, final int int3, final int int4) { checkUnsignedShort(int1); checkUnsignedShort(int2); checkUnsignedShort(int3); checkUnsignedShort(int4); return ((int1 & 0xFFFFL) << 48) + ((int2 & 0xFFFFL) << 32) + ((int3 & 0xFFFFL) << 16) + (int4 & 0xFFFFL); }  static void writeLongAsAscii(final byte[] outputBuffer, final int offset, final long valueParam); static boolean isAsciiDigit(final byte asciiCharacter); static String formatIntAsIpAddress(final int address); static void formatIntAsIpAddress(final StringBuilder buffer, final int address); static long packLongWithUnsignedShortInts(final int int1, final int int2, final int int3, final int int4); static boolean isEqual(final byte[] lhs, final int lhsOffset, final byte[] rhs, final int rhsOffset, final int length); static int readIntFromAscii(final byte[] asciiBuffer, final int offset, final int length); static long readLongFromAscii(final byte[] asciiBuffer, final int offset, final int length); static boolean isInteger(final byte[] asciiBuffer, final int offset, final int length); static void replace(final byte[] buffer, final int offset, final int length,
                               final byte target, final byte replacement); static void asciiEncode(final CharSequence chars, final int charOffset,
                                   final byte[] buffer, final int bufferOffset, final int length); }
ByteUtil { public static long packLongWithUnsignedShortInts(final int int1, final int int2, final int int3, final int int4) { checkUnsignedShort(int1); checkUnsignedShort(int2); checkUnsignedShort(int3); checkUnsignedShort(int4); return ((int1 & 0xFFFFL) << 48) + ((int2 & 0xFFFFL) << 32) + ((int3 & 0xFFFFL) << 16) + (int4 & 0xFFFFL); }  static void writeLongAsAscii(final byte[] outputBuffer, final int offset, final long valueParam); static boolean isAsciiDigit(final byte asciiCharacter); static String formatIntAsIpAddress(final int address); static void formatIntAsIpAddress(final StringBuilder buffer, final int address); static long packLongWithUnsignedShortInts(final int int1, final int int2, final int int3, final int int4); static boolean isEqual(final byte[] lhs, final int lhsOffset, final byte[] rhs, final int rhsOffset, final int length); static int readIntFromAscii(final byte[] asciiBuffer, final int offset, final int length); static long readLongFromAscii(final byte[] asciiBuffer, final int offset, final int length); static boolean isInteger(final byte[] asciiBuffer, final int offset, final int length); static void replace(final byte[] buffer, final int offset, final int length,
                               final byte target, final byte replacement); static void asciiEncode(final CharSequence chars, final int charOffset,
                                   final byte[] buffer, final int bufferOffset, final int length); static final int MAX_UNSIGNED_SHORT; }