About 4,980,000 results
Open links in new tab
  1. How do I initialize a byte array in Java? - Stack Overflow

    Jun 26, 2012 · In Java 6, there is a method doing exactly what you want: private static final byte[] CDRIVES = javax.xml.bind.DatatypeConverter.parseHexBinary ...

  2. Why is the range of bytes -128 to 127 in Java? - Stack Overflow

    in java all the variables like byte short int long float double are written as signed . so is very simple the head bit always specifies what is( negative or positive), but because the numbers are dividable by 2 half is shifted as negative , 0 is positive by default . so it looks like this :

  3. How do you specify a byte literal in Java? - Stack Overflow

    Mar 4, 2011 · You can use a byte literal in Java... sort of. byte f = 0; f = 0xa; 0xa (int literal) gets automatically cast to byte.

  4. How does a byte[] in java actually store data - Stack Overflow

    A Java byte is a primitive with a minimum value of -128 and a maximum value of 127 (inclusive). 87 is within the allowed range. The byte data type can be useful for saving memory in large arrays, where the memory savings actually matters. A byte[] is an Object which stores a number of these primitives.

  5. Purpose of byte type in Java - Stack Overflow

    I read this line in the Java tutorial: 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.

  6. Para o que serve tipo byte Java - Stack Overflow em Português

    Apr 29, 2014 · A documentação do Java diz o seguinte sobre 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.

  7. Convert byte to string in Java - Stack Overflow

    Dec 28, 2011 · Because gustafc's answer has a very important point: String(byte[]) constructor uses the System default encoding to convert the byte array into String characters. One should not assume that a 0x63 byte value is mapped to the letter 'c'. For example, in UTF-16 the letter 'c' is represented by 2 encoding bytes, not one.

  8. java - How to convert byte[] to Byte[] and the other way around ...

    Oct 17, 2012 · Step back. Look at the bigger picture. You're stuck converting byte[] to Byte[] or vice versa because of Java's strict type casing with something like this. List< Byte> or List<Byte[]> Now you have byte[] and Byte[] and have to convert. This will help. Keep all your byte[]s in a list like this: List<byte[]> instead of List< Byte> or List<Byte[]>.

  9. java - UTF-8 byte [] to String - Stack Overflow

    Apr 10, 2015 · Let's suppose I have just used a BufferedInputStream to read the bytes of a UTF-8 encoded text file into a byte array. I know that I can use the following routine to convert the bytes to a string, ...

  10. java - Converting char [] to byte [] - Stack Overflow

    Jan 28, 2014 · Convert without creating String object:. import java.nio.CharBuffer; import java.nio.ByteBuffer; import java.util.Arrays; byte[] toBytes(char[] chars) { CharBuffer ...

Refresh