Number.byteValue() has the following syntax.
public byte byteValue()
In the following code shows how to use Number.byteValue() method.
// w w w . j a va 2s. co m public class Main { public static void main(String[] args) { // get a number as integer Number x = new Integer(123456); // get a number as float Number y = new Float(9876f); // print their value as byte System.out.println("x as integer:" + x + ", x as byte:" + x.byteValue()); System.out.println("y as float:" + y + ", y as byte:" + y.byteValue()); } }
The code above generates the following result.