I think one of the test case fore this problem is damn wrong. If you put 1 as an input my code returning product as 66 which is correct palindrome where as the question expecting answer to be. My code is as follows :

```
public static int largestPalindrome(int n) {
long product = 0;
long product_start = ((long) Math.pow(10, n-1))*((long) Math.pow(10, n-1)+1);
long product_end = ((long) Math.pow(10, n)-2) * ((long) Math.pow(10, n)-1);
for (long i = product_start; i<=product_end; i++) {
//call palindrome
if(isPal(String.valueOf(i))) {
if (product<i) {
product = i;
}
}
}
return (int) product%1337;
}
public static boolean isPal(String str) {
if(str.length()==0 || str.length() ==1) {
return true;
}
else {
if(str.charAt(0) == str.charAt(str.length()-1)) {
String subString = str.substring(1, str.length()-1);
return isPal(str.substring(1, str.length() - 1));
} else {
return false;
}
}
}
```