Here you can find the source of toUnsignedByte(byte[] buf, int pos)
public static int toUnsignedByte(byte[] buf, int pos)
//package com.java2s; //License from project: Apache License public class Main { public static int toUnsignedByte(byte[] buf, int pos) { int b = buf[pos]; if (b < 0) { b = 256 + b;//from ww w . j ava 2 s . com } return b; } }