@Test public void test() { Random r = new Random(); for (int i = 0; i < 1000; i++) { String s = Integer.toBinaryString(r.nextInt(Integer.MAX_VALUE)); Assert.assertTrue(ExponentialSizeDFA.match("0" + s)); Assert.assertFalse(ExponentialSizeDFA.match("1" + s)); } }
public static boolean match(String input) { int n = input.length(); return Pattern.matches("(0|1)*0(0|1){" + (n - 1) + "}", input); }
ExponentialSizeDFA { public static boolean match(String input) { int n = input.length(); return Pattern.matches("(0|1)*0(0|1){" + (n - 1) + "}", input); } }
ExponentialSizeDFA { public static boolean match(String input) { int n = input.length(); return Pattern.matches("(0|1)*0(0|1){" + (n - 1) + "}", input); }  }
ExponentialSizeDFA { public static boolean match(String input) { int n = input.length(); return Pattern.matches("(0|1)*0(0|1){" + (n - 1) + "}", input); }  static boolean match(String input); }
ExponentialSizeDFA { public static boolean match(String input) { int n = input.length(); return Pattern.matches("(0|1)*0(0|1){" + (n - 1) + "}", input); }  static boolean match(String input);  }