Code example for BufferUnderflowException

0
    } 
 
    private static int getArray0(ByteBuffer bb, int position, Object array) {
        final int size = getArraySize(array);
        if (bb.limit() - position < size)
            throw new BufferUnderflowException();
 
        if (!bb.isDirect())
            unsafe.copyMemory(bb.array(), base + bb.arrayOffset() + position, array, getArrayBase(array), size);
        else 
            unsafe.copyMemory(null, ((DirectBuffer) bb).address() + position, array, getArrayBase(array), size);
        return size;
    } 
 
    private static int getArrayBase(Object array) { 
        return unsafe.arrayBaseOffset(array.getClass());
    } 
 
    private static int getArraySize(Object array) { 
        return Array.getLength(array) * getArrayScale(array);
Experience pair programming with AI  Get Codota for Java