In: Computer Science
//   Given an array of size 9, with the values of 1-9,
determine if the array
//   is valid or not.
//   Display a message stating the row is VALId, or state
its INVALID and what
//   was the index number that determined the data
invalid.
//
//   Use this java code as a start of your code.
//   Test the array data by changing the values.
//=============================================================================
import java.util.*;
  
public class Soduko_ValidateRow
   {
public static void main(String args[])
   {
       boolean isValid = true;
       int dataRow[] = { 9, 8, 7, 6, 5, 4,
3, 2, 8 };
       }
}
import java.util.*;
public class Soduko_ValidateRow {
        public static void main(String args[]) {
                boolean isValid = true;
                int dataRow[] = { 9, 8, 7, 6, 5, 4, 3, 2, 8 };
                int counter[] = new int[10];
                boolean flag = true;
                for (int i = 0; i < dataRow.length; i++) {
                        if (counter[dataRow[i]] == 0) {
                                counter[dataRow[i]]++;
                        } else {
                                System.out.println("INVALID: Data at index " + i + " is invalid");
                                flag = false;
                                break;
                        }
                        if (dataRow[i] > 9 || dataRow[i] < 1) {
                                System.out.println("INVALID: Data at index " + i + " is invalid");
                                flag = false;
                                break;
                        }
                }
                if(flag)
                        System.out.println("VALID");
        }
}

NOTE : PLEASE COMMENT BELOW IF YOU HAVE CONCERNS.
I AM HERE TO HELP YOUIF YOU LIKE MY ANSWER PLEASE RATE AND HELP ME IT IS VERY IMP FOR ME