static int replaceByteInInt_littleEndian(int i, int byteNr, int theByte) { int mask = 255 << (byteNr*8); ret (i & ~mask) | (theByte << (byteNr*8)) & mask; }