22 package com.realtime.crossfire.jxclient.util;
24 import org.jetbrains.annotations.NotNull;
45 if (value < 1000000L) {
46 return Long.toString(value);
49 if (value < 10000000L) {
50 final long tmp = (value+50000L)/100000L;
51 return tmp/10+
"."+tmp%10+
" million";
54 if (value < 1000000000L) {
55 final long tmp = (value+500000L)/1000000L;
56 return tmp+
" million";
59 if (value < 10000000000L) {
60 final long tmp = (value+50000000L)/100000000L;
61 return tmp/10+
"."+tmp%10+
" billion";
64 final long tmp = (value+500000000L)/1000000000L;
65 return tmp+
" billion";
76 public static String
formatFloat(
final double value,
final int digits) {
80 tmp = (int)Math.round(value*10);
81 return tmp/10+
"."+tmp%10;
84 tmp = (int)Math.round(value*100);
85 return tmp/100+
"."+tmp/10%10+tmp%10;
88 tmp = (int)Math.round(value*1000);
89 return tmp/1000+
"."+tmp/100%10+tmp/10%10+tmp%10;
92 throw new IllegalArgumentException(
"invalid digits "+digits);