public class Shortdata{
public static void main(String[] args){
byte by = 45;
short sho = 32767;
System.out.println(“sho的值是”+sho);
//获取最大值
System.out.println(Byte.MAX_VALUE);
System.out.println(Short.MAX_VALUE); //获取最小值
System.out.println(Byte.MIN_VALUE);
System.out.println(Short.MIN_VALUE);
//获取整数之的编码方式
String byteStr=Integer.toBinaryString(by);
System.out.println(byteStr);
}}
在这里插入图片描述