I have an *ArrayList* defined as:

```
private static ArrayList<Byte> allocatedBytes;

```

Apparently I can read from each element just fine with:

```
byte toWrite = allocatedBytes.get(currentByteAddress);

```

However, once I manipulate *toWrite* with bitwise operations and try to write it back into the list, the compiler consistently errors.

I have tried:

```
allocatedBytes.get(currentByteAddress) = toWrite;

allocatedBytes.get(currentByteAddress) = (Byte)toWrite;

allocatedBytes.get(currentByteAddress) = Byte(toWrite);

allocatedBytes.get(currentByteAddress) = new Byte(toWrite);

allocatedBytes.get(currentByteAddress) = Byte((byte)toWrite);

```

The error is always "Variable expected". I don't understand this.

My main goal here is to manipulate this byte on the bit level. If there is an easier way, I'm all ears.