Here you can find the source of clampYaw(float yaw)
public static float clampYaw(float yaw)
//package com.java2s; //License from project: Open Source License public class Main { public static float clampYaw(float yaw) { while (yaw < -180.0F) { yaw += 360.0F;/* ww w . jav a2s. c om*/ } while (yaw >= 180.0F) { yaw -= 360.0F; } return yaw; } }