private String formatPrice(int price) {
String p = "";
if (price > 10000000) {
p = " (" + ((double) Math.round(price / 100000) / 10) + "m)";
} else if (price > 100000) {
p = " (" + (price / 1000) + "k)";
} else if (price > 1000) {
p = " (" + ((double) Math.round(price / 100) / 10) + "k)";
} else if (price > 0) {
p = " (" + price + "gp)";
}
return p;
}
Is it possible to simplify this piece of code without slowing down performance too much? It doesn't look like it's been done properly.