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