Here you can find the source of angleToFacing(float angle)
public static int angleToFacing(float angle)
//package com.java2s; //License from project: Open Source License public class Main { public static final float FACING_TO_DEGREE = 11.25f; public static int angleToFacing(float angle) { float facingDegrees = (float) Math.toDegrees(angle); return (int) (facingDegrees / FACING_TO_DEGREE); }/*from ww w . j a v a2 s . c om*/ }