首页 > 代码库 > Java进阶1(Java 谜题)

Java进阶1(Java 谜题)

1.
//判断奇偶数
 public static boolean isOdd(int i){
   return i % 2 != 0;
  }
 
2.
 //减法精确
 public static BigDecimal jian(String s1,String s2){
  BigDecimal jian=new BigDecimal(s1).
  subtract(new BigDecimal(s2));
  return jian;
 }
 
3.
//长整除算法
   public static void  chu(){
    final long MICROS_PER_DAY = 24L*60*60*1000*1000;
    final long MILLIS_PER_DAY = 24L*60*60*1000;
    System.out.println(MICROS_PER_DAY/MILLIS_PER_DAY);
   }
   

Java进阶1(Java 谜题)