JAva Byteメソッドの詳細

3346 ワード

ダイレクトコード
package com.String;

public class ByteDamo {
	static void m1() {
		//byte      
		Byte  bb=new Byte((byte) 333);
		System.out.println(bb);
		Byte jByte=new Byte("33");
		System.out.println(jByte);
	}
	
	public static void main(String[] args) {
		//m1();
		Byte ll=new Byte((byte) 4.56);
		//byteValue()      Double  byte        。 
		System.out.println(ll.byteValue());//        byte     byte 。 

		//compare(byte x, byte y)        byte 。 
		Byte kk=new Byte((byte) 20);
		Byte kk1=new Byte((byte) 80);
		System.out.println(new Byte((byte) 3).compare(kk, kk1));//     kk-kk1
		
		//compareTo(Byte anotherByte)        Byte  。
		Byte qq = 10;
		Byte ww=3;
		System.out.println(qq.compareTo(qq));//     ww-qq;
		System.out.println(ww.compareTo(qq));
		
		//decode(String nm)   String    Byte 。 
		Byte kk2=new Byte("5");
		System.out.println(kk2.decode("9"));//   Byte     byte    nm 
		
		//doubleValue()      Byte  double       。 
		System.out.println(new Byte("23").doubleValue());//        double      double 。 
		
		//equals(Object obj)               。 
		System.out.println(new Byte("22").equals(2));//    true false
		
		//floatValue()      Byte  float       。 
		System.out.println(new Byte("56").floatValue());//    float
		
		//hashCode()     Byte    ;     intValue()   。 
		System.out.println(new Byte("50").hashCode());
		System.out.println(new Byte("5").hashCode());
		
		//hashCode(byte value)     byte     ;   Byte.hashCode() 。
		System.out.println(new Byte("12").hashCode(new Byte((byte) 2)));
		
		//intValue()       Byte   int        。 
		System.out.println(new Byte("2").intValue());
		System.out.println(new Byte("-5").intValue());
		
		//longValue()      Byte  long       。
		System.out.println(new Byte("56").longValue());//     Long 
		
		//parseByte(String s)                  byte 。 
		System.out.println(new Byte("45").parseByte("2"));
		System.out.println(new Byte("45").parseByte("10"));//        
		System.out.println(new Byte("45").parseByte("-3"));
		
		//parseByte(String s, int radix)                           byte 。 
		System.out.println(new Byte((byte) 22).parseByte("11", 3));//      11 3      10   byte   4 ,   11      3   
		//     string     ,      2   36      
		System.out.println(new Byte("23").parseByte("11", 4));
		System.out.println(Byte.parseByte("1", 2));
		
		//shortValue()      Byte  short       。 
		System.out.println(new Byte("1").shortValue());//      short
		
		//toString(byte b)        String  ,      byte 。
		System.out.println(new Byte("45").toString(new Byte((byte) 23)));
		
		//valueOf(byte b)      Byte    byte   Byte  。
		System.out.println(new Byte("12").valueOf(new Byte((byte) 6)));
		
		//valueOf(String s)      Byte             String 。 
		System.out.println(new Byte((byte) 32).valueOf("-23"));//    Byte            String 。                   byte ,
		
		//valueOf(String s, int radix) 
		//     Byte  ,         String  String  ,                 。 
		System.out.println(new Byte("23").valueOf("56", 8));//      56
		
		
		
		
		
		
		 
		
		
		

		

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
	}
}