Question

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

Was it helpful?

Solution

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.)

OTHER TIPS

As you may be aware, Java has no unsigned numbers. This means you're going to have to go with another solution. It's generally easiest to just use the next larger type in cases like these, such as int (which is simply a 32-bit signed integer).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top