public static byte[] trim(byte[] bytes) {
        int end = bytes.length - 1;
        for (int i = end; i > -1; i--) {
            if (bytes[i] != 0) {
                end = i;
                break;
            }
        }
        if (end == bytes.length - 1) {
            return bytes;
        }
        byte[] ret = new byte[end + 1];
        System.arraycopy(bytes, 0, ret, 0, end + 1);
        return ret;
    }
removes trailing 0 from byte array

@param bytes
@return
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-miscoffice-module/src/main/java/org/apache/tika/parser/dbf/DBFReader.java