@fred Вы можете использовать (int)Math.round() для округления числа до целых.
1 2 3 4 5 6 7 8 9 |
class Main { public static void main(String[] args) throws Exception { double x = 5.6; double y = 5.4; System.out.println((int)Math.round(x)); // Вывод : 6 System.out.println((int)Math.round(y)); // Вывод : 5 } } |