Java Array Contain arrayContains(final byte[] what, final byte[] b)

Here you can find the source of arrayContains(final byte[] what, final byte[] b)

Description

array Contains

License

Open Source License

Declaration

public static boolean arrayContains(final byte[] what, final byte[] b) 

Method Source Code

//package com.java2s;
/**//from   w  ww . j  av a 2 s  . c om
 *    Created on Oct 21, 2010
 *    This file is part of JObexFTP 2.0, and it contains parts of OBEX4J.
 *
 *    JObexFTP is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU Lesser General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    JObexFTP 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 Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public License
 *    along with JObexFTP.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

public class Main {
    public static boolean arrayContains(final byte[] what, final byte[] b) {
        boolean r = false;
        for (int i = b.length - 1; i > what.length; i--) {
            int j = what.length;
            while (j > -1) {
                if (b[i] != what[j]) {
                    r = false;
                    continue;
                } else {
                    r = true;
                }
            }
            if (r) {
                return r;
            }
        }
        return r;
    }
}

Related

  1. ARRAY_Contains(int value, int[] array)
  2. arrayContains(byte[] a, int offset, byte[] b)
  3. arrayContains(char[] chars, char cToFind)
  4. arrayContains(char[] chars, char cToFind)
  5. arrayContains(final E[] arr, final E targetValue)
  6. arrayContains(final int[] array, final int v)
  7. arrayContains(final Object[] a, final Object v)
  8. arrayContains(final String[] array, String needle)