public static double getAngleDifference(double pStart, double pEnd, final Boolean pClockwise) {
        final double difference = cleanPositiveAngle(pEnd - pStart);
        if (pClockwise != null) {
            if (pClockwise) {
                return difference;
            } else {
                return difference - 360;
            }
        }
        if (difference < 180) {
            return difference;
        }
        return difference - 360;
    }
@Test
    public void testGetAngleDifference() {
        Assert.assertEquals(20, MyMath.getAngleDifference(10, 30, null), DELTA);
        Assert.assertEquals(20, MyMath.getAngleDifference(10, 30, Boolean.TRUE), DELTA);
        Assert.assertEquals(-340, MyMath.getAngleDifference(10, 30, Boolean.FALSE), DELTA);

        Assert.assertEquals(-20, MyMath.getAngleDifference(30, 10, null), DELTA);
        Assert.assertEquals(340, MyMath.getAngleDifference(30, 10, Boolean.TRUE), DELTA);
        Assert.assertEquals(-20, MyMath.getAngleDifference(30, 10, Boolean.FALSE), DELTA);

        Assert.assertEquals(2, MyMath.getAngleDifference(179, -179, null), DELTA);
        Assert.assertEquals(2, MyMath.getAngleDifference(179, -179, Boolean.TRUE), DELTA);
        Assert.assertEquals(-358, MyMath.getAngleDifference(179, -179, Boolean.FALSE), DELTA);

        Assert.assertEquals(2, MyMath.getAngleDifference(359, 1, null), DELTA);
        Assert.assertEquals(2, MyMath.getAngleDifference(359, 1, Boolean.TRUE), DELTA);
        Assert.assertEquals(-358, MyMath.getAngleDifference(359, 1, Boolean.FALSE), DELTA);
    }