Here you can find the source of trunc(Float f)
public static Float trunc(Float f)
//package com.java2s; //License from project: Open Source License public class Main { public static float trunc(float f) { return Math.round(f); }/*from w w w . j av a 2 s . c o m*/ public static Float trunc(Float f) { return f != null ? trunc(f.floatValue()) : null; } public static float round(float f, int dp) { float pow = (float) Math.pow(10, dp); float round = Math.round(f * pow); return round / pow; } public static Float round(Float f, int dp) { return f != null ? round(f.floatValue(), dp) : null; } }