### Question:
HugeArrays { static int pageIndex(long index) { return (int) (index >>> PAGE_SHIFT); } private  HugeArrays(); static long oversize(long minTargetSize, int bytesPerElement);  }### Answer:
@Test void pageIndexOfFirstPage() { assertEquals(0L, pageIndex(0L)); assertEquals(0L, pageIndex(1L)); assertEquals(0L, pageIndex(PAGE_SIZE - 1)); }
@Test void pageIndexOfSecondPage() { assertEquals(1L, pageIndex(PAGE_SIZE)); assertEquals(1L, pageIndex(2 * PAGE_SIZE - 1)); }
@Test void pageIndexOfMaxPage() { assertEquals(Integer.MAX_VALUE, pageIndex((long) Integer.MAX_VALUE * PAGE_SIZE)); assertEquals(Integer.MAX_VALUE, pageIndex((long) Integer.MAX_VALUE * PAGE_SIZE + PAGE_SIZE - 1L)); }
@Test void pageIndexUndefinedWhenIndexIsTooLarge() { assertEquals(0L, pageIndex(1L << 62)); assertEquals(-1L, pageIndex(Long.MAX_VALUE)); }
@Test void pageIndexUndefinedForNegativeIndex() { assertEquals(-1L, pageIndex(-1L)); assertEquals(-1L, pageIndex(-2L)); assertEquals(0L, pageIndex(Long.MIN_VALUE)); }