How might you go about creating a List of byte[] (not Byte)?
I want something like the following:
byte[] deb = new byte[Byte.MIN_VALUE];
List<byte[]> begin = new LinkedList<>();
begin.add(deb);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That will work fine because arrays are objects in Java, so you can build
Lists out of them.Note that only in Java 7 can you do
In older versions you must restate the
byte[]:This has been brought up already but I’ll just reiterate it here.
Byte.MIN_VALUEis less than0; you cannot create an array of length less than0(it results in a runtime error, specifically aNegativeArraySizeException). Did you meanByte.MAX_VALUE?