Java Integer Align align(int min, int number, int max)

Here you can find the source of align(int min, int number, int max)

Description

align

License

LGPL

Declaration

public static int align(int min, int number, int max) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    /**/*from w w  w. j  a va 2  s  . 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));
    }
}

Related

  1. align(final int value, final int alignment)
  2. align(final int value, final int pow2alignment)
  3. align(int addr, int align)
  4. align(int cur, int longest)
  5. align(int i)
  6. align(int pos, int align)
  7. align(int size)
  8. align(int size, int align)
  9. align(int size, int alignment)