I need to translate C++ code to Java. I have two issues I am worried about.
1) Translation of ‘unsigned int’ from C++ to Java as ‘long’.
I choose to use long to increase storage capacity.
2) Use of bitwise operators, specifically | and <<. Given that
I have translate the unsigned int values to long, would this have
any bad effect for these operators? For example in C++:
unsigned int a;
unsigned int b;
unsigned int c;
a | (b<<c)
is it OK to do this in Java:
long a, b, c;
a | (b<<c)
Please let me know about any issues you think I might encounter
doing these things.
Thanks
I believe what you do is safe and should work well in Java. Bitwise operations used as you show should work as expected.