Java Array Search Search(int[] in, int val)

Here you can find the source of Search(int[] in, int val)

Description

Search

License

Open Source License

Declaration

public static final int Search(int[] in, int val) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    public static final int Search(int[] in, int val, boolean sort) {
        if (sort)
            Sort(in);//from  w w w. jav a  2 s.c  o m
        return Arrays.binarySearch(in, val);
    }

    public static final int Search(int[] in, int val) {
        return Search(in, val, true);
    }

    public static final void Sort(int[] in) {
        Arrays.sort(in);
    }
}

Related

  1. memchr(boolean[] ary, int start, int len, boolean find)
  2. memchr(char[] haystack, int offset, char needle, int num)
  3. memchr(T[] ptr, T value)
  4. replaceAll(String text, char[] toSearch, char toReplace)
  5. search(double[] input, int[] bounds, double x)
  6. searchFirst(String[] target, String key)
  7. searchInStringArray(String key, String[] data)