Add format string method

This commit is contained in:
jacques 2022-03-12 21:18:44 +01:00
parent 9fa217d587
commit 6bf1d82318

View file

@ -8,6 +8,7 @@ import android.util.Log;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.Locale;
import java.util.Random; import java.util.Random;
public class Utils { public class Utils {
@ -45,4 +46,12 @@ public class Utils {
Random r = new Random(); Random r = new Random();
return r.nextInt(max - min) +max; return r.nextInt(max - min) +max;
} }
public static String fmt(double d)
{
if(d == (long) d)
return String.format(Locale.getDefault(),"%d",(long)d);
else
return String.format("%s",d);
}
} }