简体   繁体   中英

ushort equivalent

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM