Here you can find the source of angleDif(float a, float b)
public static float angleDif(float a, float b)
//package com.java2s; //License from project: Open Source License public class Main { public static final float PI = (float) Math.PI; public static float angleDif(float a, float b) { if (b > a) return b - a > PI ? (float) (a + 2 * PI - b) : b - a; return a - b > PI ? (float) (b + 2 * PI - a) : a - b; }/*from w ww . j a v a 2 s .c om*/ }