int randomNum = (int) (Math.random() * 10) + 1; System.out.println("Random number: " + randomNum);
double angle = 45.0; double radians = Math.toRadians(angle); double sinValue = Math.sin(radians); System.out.println("Sine of " + angle + " degrees: " + sinValue);In this example, we first convert the angle from degrees to radians using the toRadians() method. We then use the sin() method to calculate the sine of the angle in radians. Overall, the java.util Math library is a useful tool for performing basic mathematical operations in Java.