Negative short primitive has wrong value on Android 24
问题 My Nexus 5X device running Android 7.0 (API level 24) has an extremely weird behavior when printing and comparing the values of short fields. public class TestActivity { public class ShortWrapper { public short s; } public void onCreate(Bundle b) { // Local short short s1 = -10; Log.d(TAG, "Local short (concatenation) = " + s1); Log.d(TAG, String.format("Local short (String.format) = %d", s1)); if(s1 == -10) Log.d(TAG, "EQUAL"); else Log.d(TAG, "!!! NOT EQUAL !!!"); // Short field