Java Code:
1 2 3 4 5 6 7 8 9 10 11 |
public class Main { public static void main(String[] args) { float floatValue = 7.7f; int intValue = Math.round(floatValue); System.out.println("The int value is: " + intValue); } } |
Output:
1 2 3 |
The int value is: 8 |