Quick actions

cmd+k|ctrl+k

Navigation

Languages

Integer pool sample

Snippet info

Language

Java

Visibility

public

Author

memo.minsk

Created

2015-09-23T11:57:53Z

Updated

2015-09-23T11:57:53Z

public class Main {
    public static void main(String[] args) {

        Integer i1 = 127;

        Integer[] arr1 = {
                127,
                100 + 27,
                Integer.parseInt("127"),
                Integer.valueOf("127")
        };

        Integer i2 = 128;

        Integer[] arr2 = {
                128,
                100 + 28,
                Integer.parseInt("128"),
                Integer.valueOf("128")
        };

        System.out.println("arr1:");
        for (int i = 0; i < arr1.length; i++) {
            System.out.print((i1 == arr1[i]) + " ");
        }

        System.out.println("\narr2:");
        for (int i = 0; i < arr2.length; i++) {
            System.out.print((i2 == arr2[i]) + " ");
        }

    }
}
INFO