Here you can find the source of clampFloat(double in)
public static final float clampFloat(double in)
//package com.java2s; /*//from ww w . j av a 2 s .c o m * $RCSfile: ImageUtil.java,v $ * * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. * * Use is subject to license terms. * * $Revision: 1.2 $ * $Date: 2006/07/21 20:53:28 $ * $State: Exp $ */ public class Main { /** The minimum value of a float. */ private static final float FLOAT_MIN = -Float.MAX_VALUE; /** Clamps a number to the range supported by float data type. */ public static final float clampFloat(double in) { return (in > Float.MAX_VALUE ? Float.MAX_VALUE : (in >= FLOAT_MIN ? (float) in : FLOAT_MIN)); } }