求一个数两位数的个位数,十位数,百位数及千位: int num = 53; int g = (num / 1) % 10; //个位 int s = (num / 10) % 10; //十位 int b = (num / 100) % 10; //百位 int b = (num / 1000) % 10; //千位 你会发现,这是有规律的,求哪一位就用这个数除以位的值,然后再对10进行求余.如果不求余那就会出现高位的数,例如,如果不对百位求余,当你输入一个四位数(3456),…
求一个数数的个位数,十位数,百位数及千位: int num = 53; int g = (num / 1) % 10; //个位 int s = (num / 10) % 10; //十位 int b = (num / 100) % 10; //百位 int b = (num / 1000) % 10; //千位 amount = String.valueOf(this.dealAmountByXXQ(new BigDecimal(amount), new BigDecimal…
class Demo{ public static void main(String[] args){ int i =2584; //do{ int g = i%10; int s = (i%100)/10; int b = (i%1000)/100; int q = i/1000; System.out.println(g); System.out.println(s); System.out.println(b); System.out.println(q); //}while(i <= 1…
一.Math类 Math类常用的方法: public static long abs (double a) 返回a的绝对值 public static double max (double a,double b) 返回a.b的最大值 public static double min (double a,double b) 返回a.b的最小值 public static double pow (double a,double b) 返回a的b次幂 public static double sqrt…
Scanner inn = new Scanner(System.in); int i = inn.nextInt(); System.out.println("个位是"+i%10+"十位是"+i/10%10+"百位是"+i/100%10+"千位是"+i/1000%10); Scanner inn = new Scanner(System.in); String s = inn.next(); for (int i=0;i&l…
JAVA之旅(十八)--基本数据类型的对象包装类,集合框架,数据结构,Collection,ArrayList,迭代器Iterator,List的使用 JAVA把完事万物都定义为对象,而我们想使用数据类型也是可以引用的 一.基本数据类型的对象包装类 左为基本数据类型,又为引用数据类型 byte Byte int Integer long Long boolean Booleab float Float double Double char Character 我们拿Integer来举例子 //整…
第十五周补充测试 1.实验楼Linux中可以通过(ABC)查看用户登录情况. A .who B .who am i C .who mom likes D .who are you 2.在 Linux 里面如何知道自己属于哪些用户组呢?(A) A .使用 groups 命令 B .addgroups C .查看 /etc/group 文件 D .lsgroups 3.表达式15&240的值为(B) A .FF B .0 C .255 D .1 4.下列关于课本P29示例程序的说法,正确的是(ABC…