How do I initialize a byte array in Java??

I have to store some constant values (UUIDs) in byte array form in java, and I'm wondering what the best way to init...

TypeError: sequence item 0: expected str instance, bytes found?

for line in fo: line = " ".join(line.split()) line = line.strip() I am getting an error line = ''.join(...

Swapping 2 Bytes of Integer?

I have a method that receives 3 parameters: int x, int n, and int m. It returns an int with the nth and mth bytes of...

How to create a byte array in C++??

Please have a look at the followng header file #pragma once class MissileLauncher { public: MissileLauncher(vo...

TypeError: a bytes-like object is required, not 'str' when writing to a file in Python3?

I've very recently migrated to Py 3.5. This code was working properly in Python 2.7: with open(fname, 'rb') as f: ...

Python write string of bytes to file?

How do I write a string of bytes to a file, in byte mode, using python? I have: ['0x28', '0x0', '0x0', '0x0'] Ho...

What does value & 0xff do in Java??

I have the following Java code: byte value = 0xfe; // corresponds to -2 (signed) and 254 (unsigned) int result = va...

Is the size of C “int” 2 bytes or 4 bytes??

Does an Integer variable in C occupy 2 bytes or 4 bytes? What are the factors that it depends on? Most of the textb...

Understanding Byte swapping?

I'm trying to figure out a way to create a little endian/big endian conversion for 64 bit integers (uint64_t) and wh...

How to know bytes size of python object like arrays and dictionaries? - The simple way?

I was looking for a easy way to know bytes size of arrays and dictionaries object, like [ [1,2,3], [4,5,6] ] or { ...

Char into byte? (Java)?

How come this happens: char a = '\uffff'; //Highest value that char can take - 65535 byte b = (byte)a; //Casting a ...

#1071 - Specified key was too long; max key length is 767 bytes?

When I executed the following command: ALTER TABLE `mytable` ADD UNIQUE ( `column1` , `column2` ); I got this err...

Convert bytes to int??

I'm currently working on an encryption/decryption program and I need to be able to convert bytes to an integer. I kn...