[Solved] rounding up a number to nearest 9
You can do: private int getInventorySize(int max) { if (max <= 0) return 9; int quotient = (int)Math.ceil(max / 9.0); return quotient > 5 ? 54: quotient * 9; } Divide the number by 9.0. And taking the ceiling will get you the next integral quotient. If quotient is > 5, then simply return 54, … Read more