title: Find the longest decreasing sequence
body: <p>I am trying to find the longest sequence of decreasing numbers in an array. I am not sure what I am doing incorrectly in the following code. </p>
  
  <pre><code>public static int getDecSeq(double[] data) {
    int currentSeq = 1;
    int currentIndex = 1;
  
    int longestSeq = 0;
    int longestIndex = 0;
    for (int i = currentIndex; i &lt; data.length; i++) {
      if (data[i] &lt; data[i - 1]) {
        currentSeq++;
      } else {
        currentSeq = 1;
        currentIndex = i;
      }
      if (currentSeq &gt; longestSeq) {
        longestSeq = currentSeq;
        longestIndex = currentIndex;
      }
      //double[] sequence = new double[longestSeq];
      //for (int j = longestIndex; j &lt; longestSeq; j++) {
        //sequence[j]
      //}
    }
    return longestSeq;
  }//close getDecSeq 
  </code></pre>
  
  <p>Looks like now the real problem is how to set up data correctly so that I can use it in the method. </p>
  
  <p>getData(input) returns a bunch of numbers from a file and stores them in an array.</p>
  
  <p>I wrote:</p>
  
  <pre><code>double[] data = getData(input);
  System.out.println("longest sequence is" + getDecSeq(data));
  </code></pre>
  
  <p>I am doing this incorrectly. My methods work. When I declared the variable data as:</p>
  
  <pre><code>double[] data = {119.1, 186.4, 46.3, 89.0 ...};
  </code></pre>
  
  <p>Everything worked just fine. 
  So how do rewrite the way I call data to work?</p>
  
  <p>getData is</p>
  
  <pre><code>public static double[] getData(Scanner input) {
     double[] list = new double[70]; //Construct an array, length 70, to hold values from file
     int count = 0;
     while (input.hasNextDouble()) {
        double n = input.nextDouble();
        list[count] = n;
        count++;
     }
     double[] newList = new double[count];
     for (int i = 0; i &lt; newList.length; i++ ) {
        newList[i] = list[i];
  
     }
     return newList;
  }//close getData
  </code></pre>