public class PasswordCracker
{
	public static final String VALID1 = "112233";
	public static final String VALID2 = "111122";
	public static final String FAILS = "123444";
	public static void main (String[] args)
	{
		char[] digits = new char[6];
		int matchingCriteria = 0;
		boolean debug = false;

		for (int i = 0; i < args.length; i++)
		{
			if ("-help".equals(args[i]))
			{
				System.out.println("Usage: [-help] [-debug] [-verify]");
				System.exit(0);
			}

			if ("-verify".equals(args[i]))
			{
				verify(debug);
				System.exit(0);
			}

			if ("-debug".equals(args[i]))
				debug = true;
		}

		for (int i = _minRange; i <= _maxRange; i++)
		{
			String str = new String(""+i);

			if (adjacentDigits(str, debug) && monotonicallyIncreasing(str, debug))
			{
				matchingCriteria++;

				if (debug)
					System.out.println("Matched:"+ str);
			}
		}

		System.out.println("Matching criteria: "+matchingCriteria);
	}

	private static final void verify (boolean debug)
	{
		if (adjacentDigits(VALID1, debug) && monotonicallyIncreasing(VALID1, debug))
		{
			if (debug)
				System.out.println("Verified "+VALID1);

			if (adjacentDigits(VALID2, debug) && monotonicallyIncreasing(VALID2, debug))
			{
				if (debug)
					System.out.println("Verified "+VALID2);

				if (!adjacentDigits(FAILS, debug) && monotonicallyIncreasing(FAILS, debug))
				{
					if (debug)
						System.out.println("Verified "+FAILS);

					System.out.println("Verified ok!");
				}
				else
					System.out.println("Failed to verify: "+FAILS);
			}
			else
				System.out.println("Failed to verify: "+VALID2);
		}
		else
			System.out.println("Failed to verify: "+VALID1);
	}

	private static final boolean adjacentDigits (String str, boolean debug)
	{
		char[] digits = str.toCharArray();
		int adjacent = 0;
		int sequenceStart = -1;

		for (int i = 1; i < digits.length; i++)
		{
			System.out.println("Index "+i);

			if (debug)
				System.out.println("Checking "+digits[i-1]+" against "+digits[i]+" and "+sequenceStart);

			if (digits[i-1] == digits[i])
			{
				if (sequenceStart != -1)
				{
					System.out.println("Sequence started at "+sequenceStart);
					System.out.println("Comparing "+digits[i]+" "+digits[sequenceStart]);

					if (digits[i] != digits[sequenceStart])
					{
						adjacent++;
						sequenceStart = i-1;
					}
				}
				else
				{
					System.out.println("Starting sequence at "+(i-1));

					adjacent++;
					sequenceStart = i-1;
				}
			}
		}

		if (debug)
			System.out.println("There are "+adjacent+" adjacents for "+str);

		return (adjacent > 0);
	}

	/*
	 * ASCII codes increase so don't need to convert char to int.
	 */

	private static final boolean monotonicallyIncreasing (String str, boolean debug)
	{
		char[] digits = str.toCharArray();

		if (debug)
			System.out.println("Comparing "+digits[0]+" and "+digits[1]);

		if (digits[0] <= digits[1])
		{
			if (debug)
				System.out.println("Comparing "+digits[1]+" and "+digits[2]);

			if (digits[1] <= digits[2])
			{
				if (debug)
					System.out.println("Comparing "+digits[2]+" and "+digits[3]);

				if (digits[2] <= digits[3])
				{
					if (debug)
						System.out.println("Comparing "+digits[3]+" and "+digits[4]);

					if (digits[3] <= digits[4])
					{
						if (debug)
							System.out.println("Comparing "+digits[4]+" and "+digits[5]);

						if (digits[4] <= digits[5])
							return true;
					}
				}
			}
		}

		return false;
	}

	private static final int _minRange = 130254;
	private static final int _maxRange = 678275;
}

@@ -1815,16 +1815,58 @@
  = -1;%0A%0A
+%09%09System.out.println(%22%5CnScanning %22+str);%0A%0A
 %09%09for (i
@@ -1932,23 +1932,206 @@
 (%22Index 
+at 
 %22+i);%0A%0A
+%09%09%09if (sequenceStart == -1)%0A%09%09%09%09System.out.println(%22No sequence yet found.%22);%0A%09%09%09else%0A%09%09%09%09System.out.println(%22Sequence %22+digits%5BsequenceStart%5D+%22 starts at index %22+sequenceStart);%0A%0A
 %09%09%09if (d
@@ -2165,24 +2165,30 @@
 n(%22Checking 
+digit 
 %22+digits%5Bi-1
@@ -2199,16 +2199,22 @@
 against 
+digit 
 %22+digits
@@ -2332,33 +2332,39 @@
 em.out.println(%22
-S
+Found s
 equence started 
@@ -2411,32 +2411,38 @@
 ntln(%22Comparing 
+digit 
 %22+digits%5Bi%5D+%22 %22+
@@ -2438,16 +2438,41 @@
 its%5Bi%5D+%22
+ and start sequence digit
  %22+digit
@@ -2587,32 +2587,60 @@
 t = i-1;%0A%09%09%09%09%09%7D%0A
+%09%09%09%09%09else%0A%09%09%09%09%09%09adjacent--;%0A
 %09%09%09%09%7D%0A%09%09%09%09else%0A%09
@@ -2673,16 +2673,11 @@
 ln(%22
-Starting
+New
  seq
@@ -2682,16 +2682,38 @@
 equence 
+%22+digits%5Bi-1%5D+%22 found 
 at %22+(i-

Update PasswordCracker.java