- if (value.toLowerCase().endsWith("m")) {
- count = Long.parseLong(value.substring(0,
- value.length() - 1).trim());
- count *= 1000000;
- } else if (value.toLowerCase().endsWith("k")) {
- count = Long.parseLong(value.substring(0,
- value.length() - 1).trim());
- count *= 1000;
- } else {
- count = Long.parseLong(value);
+ int mult = 1;
+ if (value.endsWith("m")) {
+ value = value.substring(0, value.length() - 1).trim();
+ mult = 1000000;
+ } else if (value.endsWith("k")) {
+ value = value.substring(0, value.length() - 1).trim();
+ mult = 1000;
+ }
+
+ long deci = 0;
+ if (value.contains(".")) {
+ String[] tab = value.split("\\.");
+ if (tab.length != 2) {
+ throw new NumberFormatException(value);
+ }
+ double decimal = Double.parseDouble("0."
+ + tab[tab.length - 1]);
+ deci = ((long) (mult * decimal));
+ value = tab[0];