Java Problem:Credit card validator
import java.util.*; public class Program { public static void main(String[] args) { Scanner x = new Scanner(System.in); int counter =0; int allnumbs=0; int check =0; String y = x.nextLine(); String g =""; for(int i =15;i>=0;i--) {g+=y.charAt(i);} check = g.length(); String[] i = g.split(""); if(check==16){ for(String j : i) {counter++; int calc = Integer.parseInt(j); if (counter%2==0){calc*=2;} if (calc>9){calc-=9;} allnumbs+=calc; } allnumbs%=10; if(allnumbs==0){ System.out.println("valid");} else{System.out.println("not valid");} }else if(check!=16){System.out.println("not valid");} } } Only 5 out of 7.dont get it why I'm stuck now. Problem Link: https://www.sololearn.com/coach/96?ref=app Need help :D(not the solution just hints) https://code.sololearn.com/cla8bgxSW0f6/?ref=app