23 package com.realtime.crossfire.jxclient.util;
25 import org.jetbrains.annotations.NotNull;
46 if (value < 1000000L) {
47 return Long.toString(value);
50 if (value < 10000000L) {
51 final long tmp = (value+50000L)/100000L;
52 return tmp/10+
"."+tmp%10+
" million";
55 if (value < 1000000000L) {
56 final long tmp = (value+500000L)/1000000L;
57 return tmp+
" million";
60 if (value < 10000000000L) {
61 final long tmp = (value+50000000L)/100000000L;
62 return tmp/10+
"."+tmp%10+
" billion";
65 final long tmp = (value+500000000L)/1000000000L;
66 return tmp+
" billion";
77 public static String
formatFloat(
final double value,
final int digits) {
81 tmp = (int)Math.round(value*10);
82 return tmp/10+
"."+tmp%10;
85 tmp = (int)Math.round(value*100);
86 return tmp/100+
"."+tmp/10%10+tmp%10;
89 tmp = (int)Math.round(value*1000);
90 return tmp/1000+
"."+tmp/100%10+tmp/10%10+tmp%10;
93 throw new IllegalArgumentException(
"invalid digits "+digits);