Here you can find the source of startsWith(String[] beginningSegments, String[] testSegments)
private static boolean startsWith(String[] beginningSegments, String[] testSegments)
//package com.java2s; /******************************************************************************* * Copyright (c) 2009 Red Hat and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://w w w . j a v a 2s . c o m * Red Hat - Initial API and implementation *******************************************************************************/ public class Main { /** * @return True if beginningSegments[i] == testSegments[i] for all 0<=i<beginningSegments[i] */ private static boolean startsWith(String[] beginningSegments, String[] testSegments) { for (int i = 0; i < beginningSegments.length; i++) { if (!beginningSegments[i].equals(testSegments[i])) return false; } return true; } }