Java examples for java.lang:byte Array Convert
Converts a unsigned byte to an signed int value.
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { byte b = 2; System.out.println(byteToInt(b)); }/* w w w. j a va 2 s . c om*/ /** * Converts a unsigned byte to an signed int value. * * @param b a byte * @return the byte as int value */ public static int byteToInt(byte b) { return (int) b & 0x00000000FF; } }