Move utility method to ByteUtil