Byte クラスの各メソッド

import java.io.*;

public class Test {
	public static void main(String args[])
	{
		Byte b1 = new Byte("27");

		System.out.println("変数");
		System.out.println("   MAX_VALUE " + Byte.MAX_VALUE);
		System.out.println("   MIN_VALUE " + Byte.MIN_VALUE);

		System.out.println("数値へ変換");
		double d = b1.doubleValue();   // d = (double)b1は許されない
		int i = b1.intValue();
		System.out.println("   Byte " + b1 + " double " + d + " int " + i);

		System.out.println("byte型へ変換");
		System.out.println("   文字列 27 を変換 " + Byte.parseByte("27"));
		System.out.println("   文字列 1B を変換 " + Byte.parseByte("1b", 16));

		System.out.println("文字列へ変換");
		System.out.println("   " + b1 + " を文字列へ変換 " + b1.toString());

		System.out.println("Byteへ変換");
		System.out.println("   文字列 27 を変換 " + Byte.valueOf("27"));
		System.out.println("   文字列 1B を変換 " + Byte.valueOf("1b", 16));
	}
}
		
(出力)
変数
  MAX_VALUE 127
  MIN_VALUE -128
数値へ変換
  Byte 27 double 27.0 int 27
yte型へ変換
  文字列 27 を変換 27
  文字列 1B を変換 27
文字列へ変換
  27 を文字列へ変換 27
yteへ変換
  文字列 27 を変換 27
  文字列 1B を変換 27