### Question:
StringLongSequence { public long next() { short val = count++; long next = 0x30_30_30_00_00_00_00_00L; next |= toHex(val >> 12 & 0xF) << 32; next |= toHex(val >> 8 & 0xF) << 24; next |= toHex(val >> 4 & 0xF) << 16; next |= toHex(val >> 0 & 0xF) << 8; return next; }  long next();  }### Answer:
@Test public void testSequence() { StringLongSequence seq = new StringLongSequence(); assertEquals("0000000", seq.next()); assertEquals("0000001", seq.next()); assertEquals("0000002", seq.next()); assertEquals("0000003", seq.next()); assertEquals("0000004", seq.next()); assertEquals("0000005", seq.next()); assertEquals("0000006", seq.next()); assertEquals("0000007", seq.next()); assertEquals("0000008", seq.next()); assertEquals("0000009", seq.next()); assertEquals("000000A", seq.next()); assertEquals("000000B", seq.next()); assertEquals("000000C", seq.next()); assertEquals("000000D", seq.next()); assertEquals("000000E", seq.next()); assertEquals("000000F", seq.next()); assertEquals("0000010", seq.next()); }
@Test public void testEndingZero() { StringLongSequence seq = new StringLongSequence(); for (int i = 0;i < 10000;i++) { Assert.assertEquals(0, seq.next() & 0xFF); } }