public static boolean alg_24 ( int [ ] blz , int [ ] number ) { int [ ] weights = { 1 , 2 , 3 , 1 , 2 , 3 , 1 , 2 , 3 } ; int crc = 0 ; int idx = 0 ; switch ( number [ 0 ] ) { case 3 : case 4 : case 5 : case 6 : number [ 0 ] = 0 ; break ; case 9 : number [ 0 ] = number [ 1 ] = number [ 2 ] = 0 ; break ; default : break ; } for ( int i = 0 ; i < 9 ; i ++ ) { if ( number [ i ] > 0 ) { idx = i ; break ; } } for ( int i = idx , j = 0 ; i < 9 ; i ++ , j ++ ) { crc += ( ( weights [ j ] * number [ i ] ) + weights [ j ] ) % 11 ; } return ( ( crc % 10 ) == number [ 9 ] ) ; }
code by Gerd Balzuweit