title: Finding Consecutive Numbers in Java
body: <p>I'm trying to find the probability of next week's lotto numbers containing consecutive numbers using a Monte Carlo algorithm.
  I decided that sorting the numbers would probably make it easier to actually find consecutives but after a LOT of searching over the web nothing really seemed to help me for what I'm looking for </p>
  
  <pre><code>import java.util.Random;
  import java.util.Arrays;
  public class lotto {
      public static String getLottoTicket(){
              String lottoTicket = "";
              Random lottoNumbers = new Random();  //random object
              int [] ticket = new int[6];  //6 lotto numbers
              int counterr = 0;
              int a;
              for( int counter = 0; counter &lt; ticket.length; ++counter ){
                  ticket[counter] = (1 + lottoNumbers.nextInt(45) );  //numbers between 1-45
              }
              Arrays.sort( ticket );      //array class .. sorts array
              for(int counter = 0; counter &lt; ticket.length; ++counter ){
                  lottoTicket += ticket[counter];
                  lottoTicket += " ";   
              }
  
              return lottoTicket;
      }
      public static void main( String [] args ){
         int a, d, n=1, t, b;
          for(int i=1; i&lt;1000000; i++){
              int counter = 0;
              System.out.println( getLottoTicket() );
         }
      }
  }
  </code></pre>
  
  <p>This is what I have so far and I know I'll be using a counter to find the number of consecutives over the million results but I'm literally just stumped on how to actually find consecutive numbers</p>