I have few datatypes used in C# that I need to translate to Java.
uint
, Int16
, UInt16
, Nullable<Int16>
What will be the appropriate datatype for these in Java?
To convert temperatures in degrees Celsius to Fahrenheit, multiply by 1.8 (or 9/5) and add 32.
The formula for converting Fahrenheit to Celsius is C = 5/9(F-32). Fahrenheit and Celsius are the same at -40°. At ordinary temperatures, Fahrenheit is a larger number than Celsius. For example, body temperature is 98.6 °F or 37 °C.
In C programming, we can convert the value of one data type ( int, float , double , etc.) to another. This process is known as type conversion.
The Conversion This means Celsius is 1.8 times larger than Fahrenheit. To put another way, 1 degree Fahrenheit is 5/9 degree Celsius. Despite the pretty large differences between one another, these two temperature scales intersect at -40 degrees, meaning that -40 degrees Fahrenheit is the same as -40 degrees Celsius.
Although the link provided by x2 is good, it's not all that useful when dealing with unsigned primitives. For example: the range of an int is 2,147,483,648 to 2,147,483,647 (which is the same in both languages), but the range of C#s uint is 0 to 4,294,967,295. Java doesn't have a similar primitive type, so you'd have to use something that contains that range (in this case, a long).
If you are only worried about 1-way compatibility (C# to Java) these should work:
EDIT:: I just found this article on MSDN about the differences between the data types in the two languages.
Data type equivalents between Java and C#. Hope you can find it out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With