Java examples for 2D Graphics:Angle
subtract 180 Angle
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { double angle = 2.45678; System.out.println(sub180Angle(angle)); }//from ww w . j a va2s. co m public static double sub180Angle(double angle) { while (angle > 180.) { angle = angle - 360.; } while (angle < -180.) { angle = angle + 360.; } return angle; } }