[JAVA]数字分割

/*

██╗     ███████╗ ██████╗     ███████╗██╗  ██╗██╗
██║     ██╔════╝██╔═══██╗    ██╔════╝██║  ██║██║
██║     █████╗  ██║   ██║    ███████╗███████║██║
██║     ██╔══╝  ██║   ██║    ╚════██║██╔══██║██║
███████╗███████╗╚██████╔╝    ███████║██║  ██║██║
╚══════╝╚══════╝ ╚═════╝     ╚══════╝╚═╝  ╚═╝╚═╝

数字分割

*/
public class Demo06 {
    public static void main(String[] args) {
        int money = 10_0000_0000;
        System.out.println(money);

        int years=20;
        int total = money*years;
        System.out.println(total); //-1474836480 内存溢出
        long total2 = money*((long)years);
        System.out.println(total2); //先把一个数据转换为long
    }
}
posted @ 2022-05-12 22:28  LeoShi2020  阅读(174)  评论(0)    收藏  举报