Source:
public static byte[] createModuleAAD(byte[] fileAAD, ModuleType moduleType, int rowGroupOrdinal, int columnOrdinal, int pageOrdinal) { byte[] typeOrdinalBytes = new byte[1]; typeOrdinalBytes[0] = moduleType.getValue(); if (ModuleType.Footer == moduleType) { return concatByteArrays(fileAAD, typeOrdinalBytes); } if (rowGroupOrdinal < 0) { throw new IllegalArgumentException("Wrong row group ordinal: " + rowGroupOrdinal); } short shortRGOrdinal = (short) rowGroupOrdinal; if (shortRGOrdinal != rowGroupOrdinal) { throw new ParquetCryptoRuntimeException("Encrypted parquet files can't have " + "more than Short.MAX_VALUE row groups: " + rowGroupOrdinal); } byte[] rowGroupOrdinalBytes = shortToBytesLE(shortRGOrdinal); if (columnOrdinal < 0) { throw new IllegalArgumentException("Wrong column ordinal: " + columnOrdinal); } short shortColumOrdinal = (short) columnOrdinal; if (shortColumOrdinal != columnOrdinal) { throw new ParquetCryptoRuntimeException("Encrypted parquet files can't have " + "more than Short.MAX_VALUE columns: " + columnOrdinal); } byte[] columnOrdinalBytes = shortToBytesLE(shortColumOrdinal); if (ModuleType.DataPage != moduleType && ModuleType.DataPageHeader != moduleType) { return concatByteArrays(fileAAD, typeOrdinalBytes, rowGroupOrdinalBytes, columnOrdinalBytes); } if (pageOrdinal < 0) { throw new IllegalArgumentException("Wrong page ordinal: " + pageOrdinal); } short shortPageOrdinal = (short) pageOrdinal; if (shortPageOrdinal != pageOrdinal) { throw new ParquetCryptoRuntimeException("Encrypted parquet files can't have " + "more than Short.MAX_VALUE pages per chunk: " + pageOrdinal); } byte[] pageOrdinalBytes = shortToBytesLE(shortPageOrdinal); return concatByteArrays(fileAAD, typeOrdinalBytes, rowGroupOrdinalBytes, columnOrdinalBytes, pageOrdinalBytes); }

Target:
public static byte[] createModuleAAD(byte[] fileAAD, ModuleType moduleType, int rowGroupOrdinal, int columnOrdinal, int pageOrdinal) { byte[] typeOrdinalBytes = new byte[1]; typeOrdinalBytes[0] = moduleType.getValue(); if (ModuleType.Footer == moduleType) { return concatByteArrays(fileAAD, typeOrdinalBytes); } if (rowGroupOrdinal < 0) { throw new IllegalArgumentException("Wrong row group ordinal: " + rowGroupOrdinal); } short shortRGOrdinal = (short) rowGroupOrdinal; if (shortRGOrdinal != rowGroupOrdinal) { throw new ParquetCryptoRuntimeException("Encrypted parquet files can't have " + "more than " + Short.MAX_VALUE + " row groups: " + rowGroupOrdinal); } byte[] rowGroupOrdinalBytes = shortToBytesLE(shortRGOrdinal); if (columnOrdinal < 0) { throw new IllegalArgumentException("Wrong column ordinal: " + columnOrdinal); } short shortColumOrdinal = (short) columnOrdinal; if (shortColumOrdinal != columnOrdinal) { throw new ParquetCryptoRuntimeException("Encrypted parquet files can't have " + "more than " + Short.MAX_VALUE + " columns: " + columnOrdinal); } byte[] columnOrdinalBytes = shortToBytesLE(shortColumOrdinal); if (ModuleType.DataPage != moduleType && ModuleType.DataPageHeader != moduleType) { return concatByteArrays(fileAAD, typeOrdinalBytes, rowGroupOrdinalBytes, columnOrdinalBytes); } if (pageOrdinal < 0) { throw new IllegalArgumentException("Wrong page ordinal: " + pageOrdinal); } short shortPageOrdinal = (short) pageOrdinal; if (shortPageOrdinal != pageOrdinal) { throw new ParquetCryptoRuntimeException("Encrypted parquet files can't have " + "more than " + Short.MAX_VALUE + " pages per chunk: " + pageOrdinal); } byte[] pageOrdinalBytes = shortToBytesLE(shortPageOrdinal); return concatByteArrays(fileAAD, typeOrdinalBytes, rowGroupOrdinalBytes, columnOrdinalBytes, pageOrdinalBytes); }