Java Array Contain ARRAY_Contains(int value, int[] array)

Here you can find the source of ARRAY_Contains(int value, int[] array)

Description

returns true if the array contains the value, or false if it does not

License

Open Source License

Parameter

Parameter Description
new_value a parameter

Declaration

public static boolean ARRAY_Contains(int value, int[] array) 

Method Source Code

//package com.java2s;
/*Copyright 2008 by Vladimir Polony, Stupy 24, Banska Bystrica, Slovakia
    /*w  ww  . ja v  a  2 s  .co m*/
This file is part of OpenRep FREE homeopathic software.
    
OpenRep FREE 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.
    
OpenRep FREE 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 OpenRep FREE.  If not, see <http://www.gnu.org/licenses/>.*/

public class Main {
    /** returns true if the array contains the value, or false if it does not
     * 
     * @param new_value
     * @return
     */
    public static boolean ARRAY_Contains(int value, int[] array) {
        for (int x = 0; x < array.length; x++) {
            if (array[x] == value)
                return true;
        }
        return false;
    }
}

Related

  1. arrayContains(byte[] a, int offset, byte[] b)
  2. arrayContains(char[] chars, char cToFind)
  3. arrayContains(char[] chars, char cToFind)
  4. arrayContains(final byte[] what, final byte[] b)