Java Data Type Tutorial - Byte valueOf(byte b) example








Byte valueOf(byte b) convert byte to a Byte.

Syntax

valueOf has the following syntax.

public static Byte valueOf(byte b)

Parameters

valueOf has the following parameters.

b
a byte value.

Return

valueOf returns a Byte instance representing b.

Example

In the following code shows how to use Byte.valueOf(byte b) method.

public class Main {

   public static void main(String[] args) {

      System.out.println(  Byte.valueOf((byte)12) );
   }
}

The code above generates the following result.