private boolean checkDeTaxNumber ( final String ptaxNumber ) { final int fa = Integer . parseInt ( StringUtils . substring ( ptaxNumber , 2 , 4 ) ) ; final int sb = Integer . parseInt ( StringUtils . substring ( ptaxNumber , 5 , 8 ) ) ; final int checkSum = ptaxNumber . charAt ( 12 ) - ' ' ; if ( StringUtils . startsWith ( ptaxNumber , "11" ) ) { // Berlin final int calculatedCheckSum ; if ( fa >= 27 && fa <= 30 // || fa < 31 && ( sb < 201 || sb > 693 ) // || fa == 19 && ( sb < 200 || sb > 639 && sb < 680 || sb > 680 && sb < 684 || sb > 684 ) // || fa == 37 ) { calculatedCheckSum = ( ( ptaxNumber . charAt ( 5 ) - ' ' ) * 7 // + ( ptaxNumber . charAt ( 6 ) - ' ' ) * 6 // + ( ptaxNumber . charAt ( 7 ) - ' ' ) * 5 // + ( ptaxNumber . charAt ( 8 ) - ' ' ) * 8 // + ( ptaxNumber . charAt ( 9 ) - ' ' ) * 4 // + ( ptaxNumber . charAt ( 10 ) - ' ' ) * 3 // + ( ptaxNumber . charAt ( 11 ) - ' ' ) * 2 ) // % MODULO_11 ; } else { calculatedCheckSum = ( ( ptaxNumber . charAt ( 2 ) - ' ' ) * 3 // + ( ptaxNumber . charAt ( 3 ) - ' ' ) * 2 // + ( ptaxNumber . charAt ( 4 ) - ' ' ) * 9 // + ( ptaxNumber . charAt ( 5 ) - ' ' ) * 8 // + ( ptaxNumber . charAt ( 6 ) - ' ' ) * 7 // + ( ptaxNumber . charAt ( 7 ) - ' ' ) * 6 // + ( ptaxNumber . charAt ( 8 ) - ' ' ) * 5 // + ( ptaxNumber . charAt ( 9 ) - ' ' ) * 4 // + ( ptaxNumber . charAt ( 10 ) - ' ' ) * 3 // + ( ptaxNumber . charAt ( 11 ) - ' ' ) * 2 ) // % MODULO_11 ; } return checkSum == calculatedCheckSum ; } // TODO find checksum calculation routines for the rest return true ; }
check the Tax Identification Number number country version for Germany .