Return true if c is between a and b. - Android java.lang

Android examples for java.lang:Math

Description

Return true if c is between a and b.

Demo Code

/*******************************************************************************
 * Copyright (c) 2011 MadRobot./*  www.jav a2s. co  m*/
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v2.1
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * 
 * Contributors:
 *  Elton Kent - initial API and implementation
 ******************************************************************************/
//package com.java2s;

public class Main {
    /**
     * Return true if c is between a and b.
     */
    private static boolean isBetween(float a, float b, float c) {
        return b > a ? (c >= a) && (c <= b) : (c >= b) && (c <= a);
    }
}

Related Tutorials