Java – ushort equivalent

cjavatypesushort

I have an application in C# that I'm trying to convert to java. The C# app has a few variables that are of type ushort. Is there an equivalent in java?

Thank you

Best Answer

The closest equivalent in terms of size is char, since Java doesn't have unsigned types, but it's overloaded in Java to provide additional semantics related to individual characters. In general, just pick the next largest integral type (int, in this case). (You're not the only one who wants it, though.)