Update IsRotation.java

also check the null value at the beginning