Java tutorial
//package com.java2s; public class Main { /** * Converts a double to a value between 0 and 360 * * @param x * @return double in 0-360 range */ public static float floatrev(double x) { return (float) (x - Math.floor(x / 360.0f) * 360.0f); } }