Java chooses arithmetic from the types of the operands. Dividing two ints gives another whole number, even when the method returns double. For nonnegative counts, this is useful when you need complete packs. The remainder operator % gives the pieces left over. A zero denominator throws an exception, so these tasks state when a denominator must be positive.
Converting a value to a wider type is called widening. An int can widen to long, and a cast to double can make division fractional. Timing matters: assigning an overflowing int product to long preserves the already damaged result. Widen an operand before multiplication. byte and short operands also promote to int for arithmetic; float literals need an F suffix, while ordinary decimal literals are double.