1 float f1 = 9803300f; 2 float f2 = 15834944f; 3 float val = f1/f2; 4 BigDecimal big = new BigDecimal(val).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP); 5 float v = big.floatValue(); 6 System.out.println(big); 7 8 9 DecimalFormat df = new DecimalFormat("#.##"); 10 value = Double.parseDouble(df.format(value / 1000000));
时间: 2024-10-06 19:05:37