### Question:
AllocationUtils { public static long getRequiredMemory(@NonNull AllocationShape shape) { return shape.getLength() * getElementSize(shape); }  static long getRequiredMemory(@NonNull AllocationShape shape); static int getElementSize(@NonNull AllocationShape shape); static AllocationShape buildAllocationShape(INDArray array); static AllocationShape buildAllocationShape(DataBuffer buffer); static AllocationShape buildAllocationShape(JCudaBuffer buffer); static long getByteOffset(AllocationShape shape); static DataBuffer getPointersBuffer(long[] pointers);  }### Answer:
@Test public void testGetRequiredMemory1() throws Exception { AllocationShape shape = new AllocationShape(); shape.setOffset(0); shape.setLength(10); shape.setStride(1); shape.setDataType(DataBuffer.Type.DOUBLE); assertEquals(80, AllocationUtils.getRequiredMemory(shape)); }
@Test public void testGetRequiredMemory2() throws Exception { AllocationShape shape = new AllocationShape(); shape.setOffset(0); shape.setLength(10); shape.setStride(1); shape.setDataType(DataBuffer.Type.FLOAT); assertEquals(40, AllocationUtils.getRequiredMemory(shape)); }
@Test public void testGetRequiredMemory3() throws Exception { AllocationShape shape = new AllocationShape(); shape.setOffset(0); shape.setLength(10); shape.setStride(2); shape.setDataType(DataBuffer.Type.FLOAT); assertEquals(80, AllocationUtils.getRequiredMemory(shape)); }