Q:

Is it correct to compare the modulo of two double values with an integer in Java? 

This code is working fine now but will it give correct answers in all cases ? 
Here is my code:
double val1 = 0.75;
double val2 = 0.25;

if(val1 % val2 == 0){
    // do something
}

A:

As mentioned in other answer, you should compare it with small value rather than an integer, the reason is: 
Consider there two values: 1.0 and 0.1.  If you do 1.0 % 0.1, it will give 0.09999999999999995, as the result of a rounding error.  So here if you are comparing with Integer, it will return false.  
So as mentioned in answer of @MauricePerry , following is the best practice. 
Math.abs(val1 % val2) < EPSILON //where EPSILON is a small value

