Is this function figuring out the array length, and if so can we name it getArrayLength? Can it just return an int, and then if the caller needs to put it into a byte[] they can do that through code like this:

    int length = PArrayDataType.getArrayLength(ptr, baseType);
    byte[] lengthBuf = new byte[PDataType.INTEGER.getByteSize()];
    PDataType.INTEGER.getCodec().encodeInt(lengthBuf, 0, null);
    ptr.set(lengthBuf);