Here you can find the source of angleSum(float a1, float a2)
public static float angleSum(float a1, float a2)
//package com.java2s; //License from project: Apache License public class Main { /** Sum of two angles. * The resulting angle is in the range of -pi..+pi if the input angle are * also in this range./*from ww w .j a v a 2s . c om*/ */ public static float angleSum(float a1, float a2) { double val = a1 + a2; if (val > Math.PI) { val -= 2. * Math.PI; } if (val < -Math.PI) { val += 2. * Math.PI; } return (float) val; } }