When.com Web Search

Search results

  1. Results From The WOW.Com Content Network
  2. .net - What is a byte[] array? - Stack Overflow

    stackoverflow.com/questions/3089004

    In C# (and C, C++, Java, and many other languages), a byte array is simply a contiguous chunk of memory. Thus a byte[n] array is a block of n bytes. Byte arrays typically have no type other than "byte", which is simply an 8-bit data item. Byte arrays are generally used for low-level I/O, such as read/write buffers for files and networks, as ...

  3. How can I convert a byte array to hexadecimal in Java?

    stackoverflow.com/questions/2817752

    Byte byteValue = intValue.byteValue(); // this will convert the rightmost byte of the intValue to byte, because Byte is an 8 bit object and Integer is at least 16 bit, and it will give you a signed number in this case -107

  4. Try using this one; this function will ignore all the non-character sets (like UTF-8) binaries and return a clean string. It is tested for Python 3.6 and above. def bin2str(text, encoding = 'utf-8'): """Converts a binary to Unicode string by removing all non Unicode char. text: binary string to work on.

  5. First, the byte is converted to an int via widening primitive conversion (§5.1.2), and then the resulting int is converted to a char by narrowing primitive conversion (§5.1.3). Note that in Java, most integer calculations are performed using 32-bit integers if the two operands are different types, unless one of them is a long .

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

  7. It is a common misconception that text is ASCII or UTF-8 or Windows-1252, and therefore bytes are text. Text is only text, in the way that images are only images. The matter of storing text or images to disk is a matter of encoding that data into a sequence of bytes. There are many ways to encode images into bytes: JPEG, PNG, SVG, and likewise ...

  8. c# - Literal suffix for byte in .NET? - Stack Overflow

    stackoverflow.com/questions/5378036

    The only literal suffixes in C# are for integer and real numbers as follows: u = uint. l = long. ul = ulong. f = float. m = decimal. d = double. If you want to use var, you can always cast the byte as in var y = (byte) 5. Although not really related, in C#7, a new binary prefix was introduced 0b, which states the number is in binary format.

  9. Converting string to byte array in C# - Stack Overflow

    stackoverflow.com/questions/16072709

    byte[] bytes = Encoding.ASCII.GetBytes(someString); You will need to turn it back into a string like this: string someString = Encoding.ASCII.GetString(bytes); If you can find in the code you inherited, the encoding used to create the byte array then you should be set.

  10. If you want to make it more readable and separate the bytes from each other, you can use the following code in Java 17+: Update: As @BradHards mentioned, it can be simplified. byte[] yourByteArray = { -128, 0, 127 }; // String hexString = new String(HexFormat.ofDelimiter(" ").formatHex(yourByteArray));

  11. Int = 4 Bytes (-2147483648 to 2147483647) While an 8-bit byte holds exactly one 8-bit character, if you are working with a subset of characters they can be encoded into less than 8 bits. For instance, as one example, if you only wanted to store uppercase letters A-Z, you could store up to 9 of them in one byte.