NormalizeAngle.java 564B

12345678910111213141516171819
  1. public class NormalizeAngle {
  2. public Integer normalizeValueUsingModulo(Integer angle){
  3. int angleRemainder = angle % 360;
  4. int normalizedAngle = angleRemainder > 0 ? angleRemainder : 360 + angleRemainder;
  5. return normalizedAngle;
  6. }
  7. public Integer normalizeValueUsingFloorMod(Integer angle){
  8. int angleRemainder = Math.floorMod(angle, 360);
  9. int normalizedAngle = angleRemainder > 0 ? angleRemainder : 360 + angleRemainder;
  10. return normalizedAngle;
  11. }
  12. public static void main(String[] args){
  13. }
  14. }