如果我用 byte[]
创建一个字节数组,每个元素的大小是多少?它们可以调整大小/合并吗?
谢谢,
最佳答案
不确定调整大小和合并是什么意思
来自文档:
byte: The byte data type is an 8-bit signed two's complement integer. It has a minimum value of -128 and a maximum value of 127 (inclusive). The byte data type can be useful for saving memory in large arrays, where the memory savings actually matters. They can also be used in place of int where their limits help to clarify your code; the fact that a variable's range is limited can serve as a form of documentation.
编辑:如果通过调整大小/合并你是在谈论数组本身,那么与其他数组相比,字节数组没有什么特别之处。
关于Java 字节数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7232111/