The finest integers are palindromes Challenge:


  Reverse the digits of a number and add it to the original
  until the number is a palindrome


Specifications:


  Your program should accept as its first argument a path to a filename.
  Each line in this file is one test case containing an integer n &lt; 10,000.
  
  Assume each test case will always have an answer and
  that it is computable with less than 100 iterations.
  
  For each line of input, print a line of output
  containing the number of iterations to compute the palindrome 
  and the resulting palindrome, on one line separated by a single space.


Solution:

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class ReverseAndAdd {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner input = new Scanner(new File(args[0]));

        while (input.hasNextLine()) {
            findAndPrintPalindrome(input.nextLine());
        }
    }

    private static void findAndPrintPalindrome(String line){
        System.out.println(getPalindrome(line));
    }

    private static String getPalindrome(String line) {
        int reverseCount = 0,
            currentNum = Integer.parseInt(line)
        ;

        while (!isPalindromic(currentNum)) {
            currentNum += reverse(currentNum);
            reverseCount++;
        }

        return reverseCount + " " + currentNum;
    }

    private static boolean isPalindromic(int s) {
        return s == reverse(s);
    }

    private static int reverse(int n) {
        return Integer.parseInt(
            new StringBuilder(Integer.toString(n)).reverse().toString()
        );
    }
}


Sample Input:


  8
  125
  195


Sample Output:


  0 8
  1 646
  4 9339    


I'm looking to pinpoint:


Anything I could alter to optimize this program.
General feedback on good vs poor practices in my code.
Indentation and formatting
    currentNum = Integer.parseInt(line)
    ;
Is there a chance of an MAX_INT overflow for reverse(). Seems unlikely for the given contraints though.
Since n is an integer, so negatives are allowed. In that case .reverse() will cause problem. Please check the constraints.
getPalindrome() should return a palindrome instead of an output you wish to have. Instead either have the function name changed. (Though not a big concern but ensure that when I see a function name, it shoul dbe intuitive so that I do not have to check the code for the actual output.)
Test cases:

Include 0, 9998 (max non palindromic n).
Negatives (if constraints dont mention so).
Invalid input. (Not handled by your program and may not be required but would help for a production code and not a programming challenge).



Optimisation:


reverse() though takes negligible time (in nanoseconds) but can be improved to handle all above cases along with speed in calculation. Ideone link

private static int reverseInt(int n) {
    int rev = 0;
    while(n&gt;0){
        rev = (rev*10)+n%10;
        n=n/10;
   }
   return rev;
}