there's a method for this here:
https://github.com/Parquet/parquet-mr/blob/master/parquet-common/src/main/java/parquet/bytes/BytesUtils.java#L42