LoginSignup
0
0

More than 5 years have passed since last update.

javaの小数点メモ①

Posted at

小数点以下に0が出ないようにして0は削除したい

public static String format(float d)
{
    if(d == (int) d)//0削除しなくてはならない場合
        return String.format("%d",(int)d);
    else//循環小数の場合
        return String.format("%.8s",d);
}

やったぜ

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0