Java tutorial
//package com.java2s; public class Main { public static final int DEGREES_PER_SEC = 3; /** * * @param input * @return */ public static int fourToDegrees(String input) { int deg = Integer.parseInt(input); float rnd = Math.round((float) deg / (float) DEGREES_PER_SEC) * (float) DEGREES_PER_SEC; deg = (int) rnd; return deg; } }