### Question:
QualifierCoder { public static byte[] encode(Long timestamp, Integer baseTime){ byte[] qualifier; if (0 == (timestamp & Constant.SECOND_MASK)) { int deltaTime = (int)(timestamp - baseTime); qualifier = new byte[Constant.QUALIFIER_SECOND_LENGTH]; short qualifierShort = (short)((deltaTime << 2) | (1 << 14)); System.arraycopy(Bytes.fromShort(qualifierShort), 0, qualifier, 0, Constant.QUALIFIER_SECOND_LENGTH); } else { int deltaTime = (int)(timestamp - baseTime * 1000); qualifier = new byte[Constant.QUALIFIER_MILLISECOND_LENGTH]; int qualifierInt = (int)(deltaTime | (2 << 22)); System.arraycopy(Bytes.fromInt(qualifierInt), 1, qualifier, 0, Constant.QUALIFIER_MILLISECOND_LENGTH); } return qualifier; }  static byte[] encode(Long timestamp, Integer baseTime); static Qualifier decode(byte[] bytes);  }### Answer:
@Test public void testEncode() { byte[] a = { 65, (byte) 236 }; byte[] b = QualifierCoder.encode(1506790923L, 1506790800); if (Bytes.equals(a, b)) { assertTrue(true); } else { assertTrue(false); } }
@Test public void testEncode0() { byte[] a = { 64, 0 }; byte[] b = QualifierCoder.encode(1506790800L, 1506790800); if (Bytes.equals(a, b)) { assertTrue(true); } else { assertTrue(false); } }
@Test public void testEncode1() { byte[] a = { (byte) 120, 64 }; byte[] b = QualifierCoder.encode(1506794400L, 1506790800); if (Bytes.equals(a, b)) { assertTrue(true); } else { assertTrue(false); } }
@Test public void testEncode2() { byte[] a = { (byte) 120, 84 }; byte[] b = QualifierCoder.encode(1506794405L, 1506790800); if (Bytes.equals(a, b)) { assertTrue(true); } else { assertTrue(false); } }
@Test public void testEncodeMilli() { byte[] a = { (byte) 129, (byte) 224, (byte) 121 }; byte[] b = QualifierCoder.encode(1506790923001L, 1506790800); if (Bytes.equals(a, b)) { assertTrue(true); } else { assertTrue(false); } }
@Test public void testEncodeMilli0() { byte[] a = { (byte) 128, 0, 0 }; byte[] b = QualifierCoder.encode(1506790800000L, 1506790800); if (Bytes.equals(a, b)) { assertTrue(true); } else { assertTrue(false); } }
@Test public void testEncodeMilli1() { byte[] a = { (byte) 182, (byte) 238, (byte) 128 }; byte[] b = QualifierCoder.encode(1506794400000L, 1506790800); if (Bytes.equals(a, b)) { assertTrue(true); } else { assertTrue(false); } }
@Test public void testEncodeMilli2() { byte[] a = { (byte) 183, 2, 8 }; byte[] b = QualifierCoder.encode(1506794405000L, 1506790800); if (Bytes.equals(a, b)) { assertTrue(true); } else { assertTrue(false); } }