通过封装一个printByte函数来实现输出不同的基本数据类型对应的字节大小

public class Main {
    public static void main(String[] args) {
        printByte("short");
        printByte("int");
        printByte("long");
        printByte("long long");
    }
    
    public static void printByte(String s) {
        int i = 0;
        switch (s){
            case "byte": case "boolean":
                i=1;
                break;
            case "char": case "short":
                i=2;
                break;
            case "int": case "float":
                i=4;
                break;
            case "long": case "long"+" "+"long": case "double":
                i=8;
                break;
        }
        System.out.printf("The size of %s is %d bytes.%n",s,i);
    }
}