float f = 0.123456f;
float f2 = (float)(Math.round(f*100))/100;
System.out.println(f2);

//结果:0.12

 

相关文章:

  • 2021-08-14
  • 2022-02-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-11
  • 2022-12-23
猜你喜欢
  • 2021-05-31
  • 2021-12-20
  • 2021-12-29
相关资源
相似解决方案