Sum of proper divisors
In the innermost for loop,
you have a condition to check in every cycle if k is the square root.
But most of the time it's not equal to the square root.
It would be more optimal to rework that,
and add a special treatment for square numbers once, after the loop:

for (int k = 2; k &lt; lim; k++) {
    if (testcase % k == 0) {
        sum += k + testcase / k;
    }
}
int intLim = (int) lim;
if (intLim * intLim == testcase) {
    sum += lim;
}




You don't need the reader.nextLine() calls in this code,
you can safely remove them.
You can also remove the reader.close(),
no need to close System.in.

int testcases = reader.nextInt();
//reader.nextLine();
List&lt;Integer&gt; values = new ArrayList&lt;&gt;();
for (int i = 0; i &lt; testcases; i++) {
    values.add(reader.nextInt());
    //reader.nextLine();
}
//reader.close();




Is it really important to not print a newline at the end?
If it's not important, then you can rewrite the loop as a for-each loop:

for (int testcase : values) {
    // ...
    System.out.println(sum);
}




Minor things:


It's better to declare variables with interface types when possible, so instead of ArrayList&lt;Integer&gt; values = ..., use List&lt;Integer&gt; values = ...
As of Java 7, use the diamond operator &lt;&gt; when creating parameterized types, for example List&lt;Integer&gt; values = new ArrayList&lt;&gt;()
Always use braces even with single-statement if/else/for
Put spaces around operators and parentheses, for example instead of if(testcase%k==0){ write as if (testcase % k == 0) {