Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class math_utils {
- private static String[] k = new String[] {"", "k", "m", "b", "t", "B", "T", "A", "C", "D", "E", "F"};
- public static String parsed(double d) {
- int i = 0;
- while(d>=1000) {
- i++;
- d/=1000;
- }
- char c = 0;
- String fd = new DecimalFormat("#0.00").format(d);
- if(fd.charAt(2) == c) {
- fd = new DecimalFormat("#0").format(d);
- }
- return fd+k[i];
- }
- }
Add Comment
Please, Sign In to add comment