w3resource logo

:

Java Programming Exercises

Java Math: Exercises, Practice, Solution

Java: Math Exercises [13 exercises with solution]

[An editor is available at the bottom of the page to write and execute the scripts.]

1. Write a Java program to round up the result of integer division. Go to the editor
Click me to see the solution

2. Write a Java program to get whole and fractional parts from a double value. Go to the editor
Click me to see the solution

3. Write a Java program to test if a double number is an integer. Go to the editor
Click me to see the solution

4. Write a Java program to round a float number to specified decimals. Go to the editor
Click me to see the solution

5. Write a Java program to count the absolute distinct value in an array. Go to the editor
Click me to see the solution

6. Write a Java program to reverse an integer number. Go to the editor
Click me to see the solution

7. Write a Java program to convert Roman number to an integer number. Go to the editor
Click me to see the solution

8. Write a Java program to convert an integer value to absolute value. Go to the editor
Click me to see the solution

9. Write a Java program to convert a float value to absolute value. Go to the editor
Click me to see the solution

10. Write a Java program to accept a float value of number and return a rounded float value. Go to the editor
Click me to see the solution

11. Write a Java program to accept two integers and return true if the either one is 15 or if their sum or difference is 15. Go to the editor
Click me to see the solution

12. Write a Java program to count the number of prime numbers less than a given positive number. Go to the editor
Click me to see the solution

13. Write a Java program to find the length of the longest sequence of zeros in binary representation of an integer. Go to the editor
Click me to see the solution

Java Practice online