Java Number Max Value max(final float a, final float b, final float c)

Here you can find the source of max(final float a, final float b, final float c)

Description

Returns the maximum value of three floats.

License

Open Source License

Parameter

Parameter Description
a a parameter
b a parameter
c a parameter

Return

max val

Declaration

public static final float max(final float a, final float b, final float c) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2012 Andreas H?hmann/* w w  w.  j a v a  2  s  . co m*/
 *
 * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 *******************************************************************************/

public class Main {
    public static final double max(final double a, final double b) {
        return a > b ? a : b;
    }

    public static final double max(final double a, final double b, final double c) {
        return a > b ? a > c ? a : c : b > c ? b : c;
    }

    public static final float max(final float a, final float b) {
        return a > b ? a : b;
    }

    /**
     * Returns the maximum value of three floats.
     * 
     * @param a
     * @param b
     * @param c
     * @return max val
     */
    public static final float max(final float a, final float b, final float c) {
        return a > b ? a > c ? a : c : b > c ? b : c;
    }

    public static final int max(final int a, final int b) {
        return a > b ? a : b;
    }

    /**
     * Returns the maximum value of three ints.
     * 
     * @param a
     * @param b
     * @param c
     * @return max val
     */
    public static final int max(final int a, final int b, final int c) {
        return a > b ? a > c ? a : c : b > c ? b : c;
    }
}

Related

  1. max(double x, double y)
  2. max(double x0, double x1, double x2)
  3. max(final double a, final double b, final double c)
  4. max(final float a, final float b)
  5. max(final float a, final float b)
  6. max(final int a, final int b)
  7. max(final int a, final int b)
  8. max(final Iterable numbers)
  9. max(final Iterable values)