Some cleanup.

The reason the "& 0xFF" were needed in the Java implementation is
that bytes there are signed. C# has an unsigned byte type. Also
some other minor cleanup.