Java examples for java.lang:byte Array Convert
Convert an unsigned byte to an int
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { byte b = 2; System.out.println(unsignedByteToInt(b)); }//from www . j a v a2 s. c om /** * Convert an unsigned byte to an int */ public static int unsignedByteToInt(byte b) { return (int) b & 0xFF; } }