private boolean checkIeVatId ( final String pvatId ) { final char checkSum = pvatId . charAt ( 9 ) ; String vatId = pvatId ; if ( pvatId . charAt ( 3 ) >= ' ' && pvatId . charAt ( 3 ) <= ' ' ) { // old id, can be transfered to new form vatId = pvatId . substring ( 0 , 2 ) + "0" + pvatId . substring ( 4 , 9 ) + pvatId . substring ( 2 , 3 ) + pvatId . substring ( 9 ) ; } final int sum = ( vatId . charAt ( 2 ) - ' ' ) * 8 + ( vatId . charAt ( 3 ) - ' ' ) * 7 + ( vatId . charAt ( 4 ) - ' ' ) * 6 + ( vatId . charAt ( 5 ) - ' ' ) * 5 + ( vatId . charAt ( 6 ) - ' ' ) * 4 + ( vatId . charAt ( 7 ) - ' ' ) * 3 + ( vatId . charAt ( 8 ) - ' ' ) * 2 ; final int calculatedCheckSum = sum % 23 ; final char calculatedCheckSumCharIe ; if ( calculatedCheckSum == 0 ) { calculatedCheckSumCharIe = ' ' ; } else { calculatedCheckSumCharIe = ( char ) ( ' ' + calculatedCheckSum - 1 ) ; } return checkSum == calculatedCheckSumCharIe ; }
check the VAT identification number country version for Ireland .