Here you can find the source of truncate(int z, int base, int max)
public static int truncate(int z, int base, int max)
//package com.java2s; //License from project: Apache License public class Main { public static int truncate(int z, int base, int max) { if (z + base > max) { return max - z; } else {//from w w w.j a v a 2s.c o m return z; } } }