> For the complete documentation index, see [llms.txt](https://r24zeng.gitbook.io/leetcode-notebook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://r24zeng.gitbook.io/leetcode-notebook/useful-java-knowledge/arrays-vs-math-vs-collections.md).

# Arrays vs Math vs Collections

### Arrays (用于固定长度的数组）

{% code title="Arrays.fill(array, num)" %}

```java
int[][] a = new int[m][n];
for(int[] array: a) {
    Arrays.fill(array, 1);
}

Arrays.sort(array[0], startIndex, end);
Arrays.sort(array[0]);   // O(NlogN)
```

{% endcode %}

### Math

Math.min, Math.max

### Collections
