title: Java Account number Validation
body: <p>Account Validation formula picture.</p>
  
  <p><a href="https://i.stack.imgur.com/I5Q1M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/I5Q1M.png" alt="Account Validation formula picture"></a></p>
  
  <p>Hi , </p>
  
  <p>I am trying to validate the account number using the formula attached in the picture.</p>
  
  <p>The account number would be in string. At end I need to check and return the correct account number after
  perform the validation above correctly.</p>
  
  <p>The account number would be different but for this example we can test with 21412900192413. 
  I just have managed to separate both of the string to array with int datatype for each so that easier to perform
  the calculation. Can anyone help me to complete this to validate the account according to the formula attached in the picture 
  above please?</p>
  
  <p>My code so far:</p>
  
  <pre><code>public static void main(String[] args) throws Exception {
      System.out.println("test");
      String strAccount = "21412900192413";
      String fixedValues = "65432987654320";
      //for account number
      String sampleString = strAccount;
        String[] stringArray = sampleString.split("");
        int[] intArray = new int[stringArray.length];
        for (int i = 0; i &lt; stringArray.length; i++) {
           String numberAsString = stringArray[i];
           intArray[i] = Integer.parseInt(numberAsString);
        }
        System.out.println("Number of integers: " + intArray.length);
        System.out.println("The integers are:");
        for (int number1 : intArray) {
           System.out.println(number1);
        }
  
      //for fixed values
      String sampleFixedValues = fixedValues;
        String[] stringArray2 = sampleFixedValues.split("");
        int[] intArray2 = new int[stringArray2.length];
        for (int i = 0; i &lt; stringArray2.length; i++) {
           String numberAsString = stringArray2[i];
           intArray2[i] = Integer.parseInt(numberAsString);
        }
        System.out.println("Number of fixed values: " + intArray2.length);
        System.out.println("The fixed values are:");
        for (int number2 : intArray2) {
           System.out.println(number2);
        }
  
  
  }
  </code></pre>