void () { int enoughIds = 1 << 20; for (long recordId = -enoughIds; recordId < enoughIds; recordId++) { long recordOffset; try { recordOffset = AppendOnlyLogOverMMappedFile.recordIdToOffset(recordId); } catch (AssertionError | IllegalArgumentException e) { continue;//invalid id, OK } //...but if id is accepted by .recordIdToOffset() -- the offset generated must // be accepted by .recordOffsetToId(), and return original recordId long id = AppendOnlyLogOverMMappedFile.recordOffsetToId(recordOffset); assertEquals( recordId + " -> " + recordOffset + " -> " + id, recordId, id ); } }