在字节中存储字节数组的最快方法?

时间:2010-02-15 20:36:30

标签: java arrays

我想知道在java中使用整数索引存储byte[]的最快方法是什么,而不使用Maps,TreeMap,ArrayLists等。

即。不喜欢这样:

private Map<Integer, byte[]> example = new TreeMap()

3 个答案:

答案 0 :(得分:2)

private byte[][] example;
example = new byte[][ARRAYS_COUNT];
example[0] = new byte[10];
example[1] = new byte[20];
...

答案 1 :(得分:1)

最快的方式是ArrayList<byte[]>,或者你想要与否。 byte[][]不会起作用,因为你只能容纳2个 8 -1阵列,而不是2 32 -1,因为你可以使用整数索引。

答案 2 :(得分:0)

如何byte[][]并适当调整大小?不如ArrayList,但你禁止......

相关问题