It looks like our TINYINT type needs to be signed, because that's the way Java treats it. So I think we need to do the sign bit flipping then, otherwise the negatives will sort after the positives, right?