suppose I write some very simple tests in an android app working on simulator (marshmallow, OSX 64 bits) whith logcat output:
Log.i("test","long int = "+17301768L);
Log.i("test","long int = "+(1<<3 | 1<<8 | 1<<19 | 1<<24));
Log.i("test","long int = "+ 8607236360L);
Log.i("test","long int = "+(1<<3 | 1<<8 | 1<<19 | 1<<24 | 1<<33));
…logcat prints:
long int = 17301768
long int = 17301768
long int = 8607236360
long int = 17301770
Obviously, last line is not correct : it should be the same as the third line.
Why ? And how can I make it working as expected ?