Your way is correct. But with a small correction.
1)
a.get(0).intValue() == b.get(0).intValue()
2)
a.get(0).equals(b.get(0))
This is the problem in your code, you have to get(0), instead of get(1). Remember, in java it always start with 0.
Values can be compared using equals()
or CompareTo method as well.
import java.util.ArrayList;
import java.util.List;
public class TestClass {
public static void main(String[] args) {
// TODO Auto-generated method stub
List<Integer> a= new ArrayList<Integer>();
a.add(128);
List<Integer> b = new ArrayList<Integer>();
b.add(128);
if(a.get(0).intValue() == b.get(0).intValue()){
System.out.println("success");
}else{
System.out.println("failure");
}
if(a.get(0).equals(b.get(0))){
System.out.println("success");
}else{
System.out.println("failure");
}
}
}