As Slippery said, i have made it lengthy
//set the angle of the image
double angle;
if(angle % 90 == 0){
//Perform operation when the angle is multiple of 90
}else{
//Perform operation when the angle is NOT multiple of 90
}
This is how you can handle this scenario