title: Java Generate Alternating Character Sequence Indefinitely
body: <p>Can someone help me achieve this please?  I'm trying to do this recursively and I'm really just getting a headache.  I want to generate a string when needed which is in the form of a pattern.  Ex.</p>
  
  <pre><code>a A b B ... z Z aa aA Aa AA bb bB Bb BB ...
  </code></pre>
  
  <p>I'm currently trying this</p>
  
  <pre><code>static int count;//a = 97, z = 122...A = 65, Z = 90
  static int length = 1;
  static boolean upper;
  
  public static void main(String args[]){
      for (int i = 0; i &lt; 10; i++){
          System.out.println(nextString(length));
      }
  }
  
  static String nextString(int len){
      char ch = (char) ((len == length ? count++ : count) / 26 + 97);
      if (upper)
          ch -= 32;
      upper = !upper;
      String s0 = String.valueOf(ch);
      if (len != 1)
          s0 = s0.concat(nextString(len - 1));
      return s0;
  }
  </code></pre>