### Question:
KeyGenerator { public static long getKeyTimeMillis(String key) throws IOException { byte[] decoded = Base64.decode(stripPreAndSuffix(key), Base64.ORDERED); if (decoded.length != 15) { throw new IOException("Invalid key: size is incorrect."); } ByteBuffer buffer = ByteBuffer.allocate(8); buffer.position(2); buffer.put(decoded, 0 ,6); buffer.flip(); return buffer.getLong(); } private  KeyGenerator(); static String createKey(); static long getKeyTimeMillis(String key); static String recreateKey(long timestamp, int random1, long random2);  }### Answer:
@Test public void testGetKeyTimeMillis() throws IOException { long t1 = System.currentTimeMillis(); String key = KeyGenerator.createKey(); long t2 = KeyGenerator.getKeyTimeMillis(key); assertThat(t2).isCloseTo(t1, Offset.offset(500L)); }