Question: I have a **uint8** *(unsigned 8 bit integer)* coming in from a UDP packet. Java only uses signed primitives. How do I parse this data structure correctly with java?

Answer: 
You can store 8-bit in a `byte` If you really need to converted it to an unsigned value (and often you don't) you can use a mask

```
byte b = ...
int u = b & 0xFF; // unsigned 0 .. 255 value

```
You can do something like this:

```
int value = eightBits & 0xff;

```

The `&` operator (like all integer operators in Java) up-casts `eightBits` to an `int` (by sign-extending the sign bit). Since this would turn values greater than 0x7f into negative `int` values, you need to then mask off all but the lowest 8 bits.