Here you can find the source of getUByte(ByteBuffer b)
public static int getUByte(ByteBuffer b)
//package com.java2s; /*/* w ww . j a v a 2s . c o m*/ * JaamSim Discrete Event Simulation * Copyright (C) 2012 Ausenco Engineering Canada Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ import java.nio.ByteBuffer; public class Main { public static int getUByte(ByteBuffer b) { return unsign(b.get()); } public static int getUByte(ByteBuffer b, int ind) { return unsign(b.get(ind)); } public static int getUByte(byte[] b, int ind) { return unsign(b[ind]); } public static int unsign(byte b) { return (b & 0xff); } }