Short クラスの各メソッド

import java.io.*;

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

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

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

		System.out.println("short型へ変換");
		System.out.println("   文字列 427 を変換 " + Short.parseShort("427"));
		System.out.println("   文字列 1AB を変換 " + Short.parseShort("1ab", 16));

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

		System.out.println("Shortへ変換");
		System.out.println("   文字列 427 を変換 " + Short.valueOf("427"));
		System.out.println("   文字列 1AB を変換 " + Short.valueOf("1ab", 16));
	}
}
		
(出力)
変数
  MAX_VALUE 32767
  MIN_VALUE -32768
数値へ変換
  Short 427 double 427.0 int 427
hort型へ変換
  文字列 427 を変換 427
  文字列 1AB を変換 427
文字列へ変換
  427 を文字列へ変換 427
hortへ変換
  文字列 427 を変換 427
  文字列 1AB を変換 427