flip Value In Range - Android java.lang

Android examples for java.lang:Math

Description

flip Value In Range

Demo Code

/**/*from   w  ww  .j a v a 2s. co  m*/
 * Alni Common - Common utilities to be used with Android development
 * Copyright (C) 2011-2013  Alexander Nilsen
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * @author Alexander Nilsen
 *
 */
//package com.java2s;

import static java.lang.Math.*;

public class Main {
    public static int flipValueInRange(int value, int max) {
        return abs(value - max);
    }

    public static float flipValueInRange(float value, float max) {
        return abs(value - max);
    }
}

Related Tutorials