Java示例
2016-04-12 23:15
441 查看
依次打印long类型数字各位上的数:
private void longPrint(){ long Xmask = 212321323144L; long sum = Xmask; long total = 0L; long current = 0L; for(int index = 1; index < 13; index++){ total = sum; sum = sum / 10; current = total - sum * 10; Log.d(TAG, "@justinTest current: " + current); } /* long firstValue = Xmask / (long)(Math.pow(10, 11)); Log.d(TAG, "@justinTest current: " + current); Xmask = Xmask - firstValue * (long)(Math.pow(10, 11)); Log.d(TAG, "@justinTest Xmask: " + Xmask); */ for(int index = 0, count = 13; index < 12; index++, count--){ long currentValue = Xmask / (long)(Math.pow(10, count-2)); Xmask = Xmask - currentValue * (long)(Math.pow(10, count-2)); Log.d(TAG, "@justinTest currentValue:"+currentValue+" Xmask: " + Xmask); } }
相关文章推荐
- 20145229吴姗珊 《Java程序设计》两天小总结
- Java实现八数码问题
- 牛客网-华为机试在线训练-2.取近似值
- Eclipse使用总结
- 编写程序,将指定目录下所有.java 文件拷贝到另一个目的中,并将扩展名改为.txt。
- Spring中bean的scope
- Maven配置Spring+SpringMVC+MyBatis(3.2.2)Pom
- Java I/O(一) NIO概述
- Intellijidea建javaWeb以及Servlet简单实现
- myeclipse与mysql练习
- java OPENCV 连通域, Imgproc.findContours 例子,参数说明
- struts2标签在jsp不显示问题(不经过action跳转)
- JAVA多线程学习(一)
- java字节码中的aload_0
- LeetCode Merge Sorted Array 88
- Java枚举类
- Hibernate映射集合(JDK以及嵌入式值类)
- Java获取 JVM 运行信息
- java:解决在nextInt()后使用nextLine()的方法
- java上机课代码。。。重写equals方法,toString方法。。。