Java Number Min Value minIndent(int a, int b)

Here you can find the source of minIndent(int a, int b)

Description

Determine the 'known minimum' of two indentation levels.

License

Open Source License

Declaration

public static int minIndent(int a, int b) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2015 Pivotal, Inc.//from w  ww  . j  a va 2 s .co  m
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Pivotal, Inc. - initial API and implementation
 *******************************************************************************/

public class Main {
    /**
     * Determine the 'known minimum' of two indentation levels. Correctly handle
     * when either one or both indent levels are '-1' (unknown).
     */
    public static int minIndent(int a, int b) {
        if (a == -1) {
            return b;
        } else if (b == -1) {
            return a;
        } else {
            return Math.min(a, b);
        }
    }
}

Related

  1. minimum(int a, int b, int c)
  2. minimum(int a, int b, int c)
  3. minimum(Integer one, Integer two)
  4. minimum(long a, long b, long c)
  5. minimumEditDistance(String target, String source)
  6. minIndex(int a, int b)
  7. minIndex(int ix1, int ix2)
  8. minIndexOfOneOf(String string, int start, String needles)
  9. minInt(double d)