001/* 002MIT License 003 004Copyright (c) 2020 FBSQL Team 005 006Permission is hereby granted, free of charge, to any person obtaining a copy 007of this software and associated documentation files (the "Software"), to deal 008in the Software without restriction, including without limitation the rights 009to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 010copies of the Software, and to permit persons to whom the Software is 011furnished to do so, subject to the following conditions: 012 013The above copyright notice and this permission notice shall be included in all 014copies or substantial portions of the Software. 015 016THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 017IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 018FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 019AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 020LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 021OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 022SOFTWARE. 023 024Home: https://fbsql.github.io 025E-Mail: fbsql.team@gmail.com 026*/ 027 028package org.fbsql.servlet; 029 030import java.util.Objects; 031 032public class CommonUtils { 033 034 public static int indexOf(Object[] array, Object[] subArray) { 035 boolean found = false; 036 for (int i = 0; i <= array.length - subArray.length; i++) { 037 if (Objects.equals(array[i], subArray[0])) { 038 for (int j = 1; j < subArray.length; j++) { 039 if (Objects.equals(array[i + j], subArray[j])) 040 found = true; 041 else { 042 found = false; 043 break; 044 } 045 } 046 } 047 if (found) 048 return i; 049 } 050 return -1; 051 } 052 053} 054 055/* 056Please contact FBSQL Team by E-Mail fbsql.team@gmail.com 057or visit https://fbsql.github.io if you need additional 058information or have any questions. 059*/ 060 061/* EOF */