Problems with Java Arrays.sort() on sub-arrays -- is this a bug? : <p>I have noticed odd behavior when using Java Arrays.sort() on sub-arrays.  Here is a demo program.  Is this a bug in Java?</p>

<pre><code>package sorted_subsegments;

import java.util.Arrays;

public class sortTest {
    public static void main(String[] args) {
        int A[] = {3, 2, 1};
        System.out.format("A: %s\n", Arrays.toString(A));
        Arrays.sort(A, 0, 1);
        System.out.format(" after sub array sort on A: %s\n", Arrays.toString(A));
        System.out.println("Should be A: [2, 3, 1]");
        Arrays.sort(A);
        System.out.format(" whole array sort on A: %s\n", Arrays.toString(A));
    }
}
</code></pre>
