public static void checkPositionIndex(int index, int size, String desc) {
    checkArgument(size >= 0, "negative size: %s", size);
    if (index < 0) {
      throw new IndexOutOfBoundsException(format(
          "%s (%s) must not be negative", desc, index));
    }
    if (index > size) {
      throw new IndexOutOfBoundsException(format(
          "%s (%s) must not be greater than size (%s)", desc, index, size));
    }
  }
public static void checkPositionIndex(int index, int size, String desc) {
    checkArgument(size >= 0, "negative size: %s", size);
    if (index < 0) {
      throw new IndexOutOfBoundsException(format(
          "%s (%s) must not be negative", desc, index));
    }
    if (index > size) {
      throw new IndexOutOfBoundsException(format(
          "%s (%s) must not be greater than size (%s)", desc, index, size));
    }
  }
public static void checkPositionIndex ( int index , int size , String desc ) { checkArgument ( size >= 0 , "negative size: %s" , size ) ; if ( index < 0 ) { throw new IndexOutOfBoundsException ( format ( "%s (%s) must not be negative" , desc , index ) ) ; } if ( index > size ) { throw new IndexOutOfBoundsException ( format ( "%s (%s) must not be greater than size (%s)" , desc , index , size ) ) ; } }
Ensures that {@code index} specifies a valid <i>position</i> in an array,
list or string of size {@code size}. A position index may range from zero
to {@code size}, inclusive.

@param index a user-supplied index identifying a position in an array, list
or string
@param size the size of that array, list or string
@param desc the text to use to describe this index in an error message
@throws IndexOutOfBoundsException if {@code index} is negative or is
greater than {@code size}
@throws IllegalArgumentException if {@code size} is negative
Ensures that { @code index } specifies a valid <i > position< / i > in an array list or string of size { @code size } . A position index may range from zero to { @code size } inclusive .