//labeled continue 
// continue with the next iteration of the outer loop marked by the label

public class labeledContinue {
	public static void main(String[] args) {
		String s = "search substring with or within this";
		boolean found = false;
		String sub = "within";
		int len1=s.length();
		int len2=sub.length();
		int max= len1 - len2;
		int i=0,j=0,k=0,pos=0;


		outer:
		for (i=0; i<max; i++) {
			j=i;
			for (k=0;k<len2;k++,j++) {
				if (s.charAt(j)!=sub.charAt(k)) continue outer;
			}
			found = true;
			pos=j-len2;
			break outer;
		}

		System.out.println("original string:" + s);
		System.out.print("substring found at position:" + pos + ":");
		for (i=pos;i<j; i++) System.out.print(s.charAt(i));
		System.out.println("");

	}
}

