convert Radians To Int Degrees - Java java.lang

Java examples for java.lang:Math Radian

Description

convert Radians To Int Degrees

Demo Code



public class Main{
    public static void main(String[] argv) throws Exception{
        float radians = 2.45678f;
        System.out.println(convertRadiansToIntDegrees(radians));
    }/* w w  w . j av  a 2s  . co m*/
    public static final float RAD_TO_DEG_FACTOR = (float) (180.0 / Math.PI);
    public static int convertRadiansToIntDegrees(float radians) {
        int degress = (int) Math.floor(convertRadiansToDegrees(radians));
        return OutputHelper.getCorrectMod(degress, 360);
    }
    public static float convertRadiansToDegrees(float radians) {
        return radians * RAD_TO_DEG_FACTOR;
    }
}

Related Tutorials