Java 字节数组

标签 java bytearray

如果我用 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/

相关文章:

java - 如何对实际上是 int[] 的无符号字节数组进行 base64 编码

java - 如何处理 Java 事件队列

java - 在测试中未找到带有 Jersey 的 Spring Boot 中的处理程序方法

java - 如何将字符串转换为 Java 8 字符流?

c# - 将字节数组转换为 C# 中未知类型的基本类型数组

c# socket接收字节数组长度

c# - 将 bool[] 转换为 byte[]

java - Spring Boot - 多部分文件最大上传大小异常

java - 如何在不改变android中的值的情况下按字母顺序对 HashMap 键进行排序?

file - 如何在 Clojure 中将整个二进制文件(Nippy)读入字节数组?