- public class Little {
- public static void main(String[] args) {
-
- System.out.println(LastTwo(0.0000000000000000004253675735));
- }
- public static String LastTwo(double d)
- {
- String s=new Double(d).toString();
-
- if(s.indexOf("E")==-1)
- {
- return s.substring(s.length()-2);
- }
- return s.substring(s.indexOf("E")-2,s.indexOf("E"));
- }
- }
复制代码 |