Here you can find the source of absDegrees(double degrees)
public static double absDegrees(double degrees)
//package com.java2s; //License from project: Open Source License public class Main { public static double absDegrees(double degrees) { if (degrees < 0) { for (int i = (int) Math.round(degrees / -360); i >= 0; i--) { degrees += 360;//ww w . j a v a 2 s .co m ; } } return degrees % 360; } }