How to get first and last element in an array in java? : <p>If I have an array of doubles: </p>

<pre><code>[10.2, 20, 11.1, 21, 31, 12, 22.5, 32, 42, 13.6, 23, 32, 43.3, 53, 14, 24, 34, 44, 54, 64, 15.1, 25, 35, 45, 55, 65.3, 75.4, 16, 26, 17.5,]
</code></pre>

<p>and I want to get the first element and last element so that</p>

<pre><code>firstNum = 10.2

lastNum = 17.5
</code></pre>

<p>how would I do this?</p>
