remove redundant functions from BytesUtil and fix bugs

merge in [MAPREDUCE-5994](https://issues.apache.org/jira/browse/MAPREDUCE-5994)