Java Number Range Check rangeCheck(int arrayLen, int fromIndex, int toIndex)

Here you can find the source of rangeCheck(int arrayLen, int fromIndex, int toIndex)

Description

range Check

License

Open Source License

Declaration

private static void rangeCheck(int arrayLen, int fromIndex, int toIndex) 

Method Source Code

//package com.java2s;
/*/*  ww w  .j  a  v a  2  s.c o m*/
 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */

public class Main {
    private static void rangeCheck(int arrayLen, int fromIndex, int toIndex) {
        if (fromIndex > toIndex)
            throw new IllegalArgumentException("fromIndex(" + fromIndex + ") > toIndex(" + toIndex + ")");
        if (fromIndex < 0)
            throw new ArrayIndexOutOfBoundsException(fromIndex);
        if (toIndex > arrayLen)
            throw new ArrayIndexOutOfBoundsException(toIndex);
    }
}

Related

  1. inRange(long value, long lowerBound, long upperBound)
  2. inrange2(double value, double min, double max)
  3. rangeCheck(double value)
  4. rangeCheck(final C start, final C end, final C step)
  5. rangeCheck(final int value, final int min, final int max)
  6. rangeCheck(int arrayLength, int offset, int length)
  7. rangeCheck(int index, int size)
  8. rangeCheck(int length, int fromIndex, int toIndex)
  9. rangeCheck(int value, int begin, int end)