Here you can find the source of mod(final float a, final float b)
public static final float mod(final float a, final float b)
//package com.java2s; public class Main { public static final float mod(final float a, final float b) { int n = (int) (a / b); float aa = a - n * b; if (aa < 0) { aa += b;//from w ww . ja v a 2 s. c om } return aa; } }