Output coming different in eclipse and in you editor

public void nextPermutation(ArrayList<Integer> a) {
    int i = a.size() - 1;
	for (; i > 0; i--) {
		if (a.get(i) > a.get(i - 1)) {
			Collections.swap(a, i, i - 1);
			break;
		}
	}
	if (i == 0) {
		Collections.sort(a);
		printArrayList(a);
	} else
		printArrayList(a);
}

private static void printArrayList(ArrayList<Integer> a) {
	for(int i : a) {
		System.out.print(i);
	}
}

For input A=[1] in eclipse i am getting the correct output which is 1 and in you editor when i am trying to run. The output is coming as 11

Click here to start solving coding interview questions