Equivalent to ushort

I have a C # application that I am trying to convert to java. A C # application has several variables that are of type ushort. Is there an equivalent in java?

thank

+2


source to share


3 answers


The closest equivalent in size is char

as Java has no unsigned types, but it is overloaded in Java to provide additional semantics related to individual characters. In general, just select the next largest integral type ( int

in this case). ( You are not the only one who wants this.)



+4


source


Take a look at this article: http://www.darksleep.com/player/JavaAndUnsignedTypes.html



+3


source


As you know, Java has no unsigned numbers . This means you have to go with a different solution. It is generally easiest to use the next larger type in cases such as int

(it's just a 32-bit signed integer).

+1


source







All Articles