title: how to return an array and its length in java
body: <p>i want to return a array and its length from a method in java, where the array is of type double and length is type integer,plz help
   suppose this example-:</p>
  
  <pre><code>double ar={2.3,4.5,6.7};
   int len=ar.length();
  </code></pre>
  
  <p>now i am supposed to return both the array "ar" and the variable "len".
  i tried this code can someone tell me the modification i need to do in the class so as to be able to return the required elements-:</p>
  
  <pre><code> import java.util.List;
       public class Pair
       {
        private List&lt;Double&gt; array1;
      private List&lt;Double&gt; array2;
      public Pair(List&lt;Double&gt; array1, List&lt;Double&gt; array2)
      {
          this.array1 = array1;
          this.array2 = array2;
  
      }
      public List&lt;Double&gt; getArray1() { return array1; }
      public List&lt;Double&gt; getArray2() { return array2; }
  }
  </code></pre>