Here you can find the source of align(double min, double number, double max)
Parameter | Description |
---|---|
min | a parameter |
number | a parameter |
max | a parameter |
public static double align(double min, double number, double max)
//package com.java2s; //License from project: LGPL public class Main { /**//from ww w. jav a2s.c o m * aligns number between min and max (guarantees number stays within * inclusive bounds of min and max) * * @param min * @param number * @param max * @return */ public static double align(double min, double number, double max) { return Math.min(max, Math.max(min, number)); } public static int align(int min, int number, int max) { return Math.min(max, Math.max(min, number)); } }