Buggy code:
public class DSCompiler { private static AtomicReference < DSCompiler [ ] [ ] > compilers = new AtomicReference < DSCompiler [ ] [ ] > ( null ) ; private final int parameters ; private final int order ; private final int [ ] [ ] sizes ; private final int [ ] [ ] derivativesIndirection ; private final int [ ] lowerIndirection ; private final int [ ] [ ] [ ] multIndirection ; private final int [ ] [ ] [ ] compIndirection ; private DSCompiler ( final int parameters , final int order , final DSCompiler valueCompiler , final DSCompiler derivativeCompiler ) throws NumberIsTooLargeException { } public static DSCompiler getCompiler ( int parameters , int order ) throws NumberIsTooLargeException { } private static int [ ] [ ] compileSizes ( final int parameters , final int order , final DSCompiler valueCompiler ) { } private static int [ ] [ ] compileDerivativesIndirection ( final int parameters , final int order , final DSCompiler valueCompiler , final DSCompiler derivativeCompiler ) { } private static int [ ] compileLowerIndirection ( final int parameters , final int order , final DSCompiler valueCompiler , final DSCompiler derivativeCompiler ) { } private static int [ ] [ ] [ ] compileMultiplicationIndirection ( final int parameters , final int order , final DSCompiler valueCompiler , final DSCompiler derivativeCompiler , final int [ ] lowerIndirection ) { if ( ( parameters == 0 ) || ( order == 0 ) ) { return new int [ ] [ ] [ ] { new int [ ] [ ] { new int [ ] { 1 , 0 , 0 } } } ; } final int vSize = valueCompiler . multIndirection . length ; final int dSize = derivativeCompiler . multIndirection . length ; final int [ ] [ ] [ ] multIndirection = new int [ vSize + dSize ] [ ] [ ] ; System . arraycopy ( valueCompiler . multIndirection , 0 , multIndirection , 0 , vSize ) ; for ( int i = 0 ; i < dSize ; ++ i ) { final int [ ] [ ] dRow = derivativeCompiler . multIndirection [ i ] ; <START_BUG> List < int [ ] > row = new ArrayList < int [ ] > ( ) ; <END_BUG> for ( int j = 0 ; j < ( dRow . length ) ; ++ j ) { row . add ( new int [ ] { dRow [ j ] [ 0 ] , lowerIndirection [ dRow [ j ] [ 1 ] ] , vSize + ( dRow [ j ] [ 2 ] ) } ) ; row . add ( new int [ ] { dRow [ j ] [ 0 ] , vSize + ( dRow [ j ] [ 1 ] ) , lowerIndirection [ dRow [ j ] [ 2 ] ] } ) ; } final List < int [ ] > combined = new ArrayList < int [ ] > ( row . size ( ) ) ; for ( int j = 0 ; j < ( row . size ( ) ) ; ++ j ) { final int [ ] termJ = row . get ( j ) ; if ( ( termJ [ 0 ] ) > 0 ) { for ( int k = j + 1 ; k < ( row . size ( ) ) ; ++ k ) { final int [ ] termK = row . get ( k ) ; if ( ( ( termJ [ 1 ] ) == ( termK [ 1 ] ) ) && ( ( termJ [ 2 ] ) == ( termK [ 2 ] ) ) ) { termJ [ 0 ] += termK [ 0 ] ; termK [ 0 ] = 0 ; } } combined . add ( termJ ) ; } } multIndirection [ ( vSize + i ) ] = combined . toArray ( new int [ combined . size ( ) ] [ ] ) ; } return multIndirection ; } private static int [ ] [ ] [ ] compileCompositionIndirection ( final int parameters , final int order , final DSCompiler valueCompiler , final DSCompiler derivativeCompiler , final int [ ] [ ] sizes , final int [ ] [ ] derivativesIndirection ) throws NumberIsTooLargeException { } public int getPartialDerivativeIndex ( final int ... orders ) throws DimensionMismatchException , NumberIsTooLargeException { } private static int getPartialDerivativeIndex ( final int parameters , final int order , final int [ ] [ ] sizes , final int ... orders ) throws NumberIsTooLargeException { } private static int convertIndex ( final int index , final int srcP , final int [ ] [ ] srcDerivativesIndirection , final int destP , final int destO , final int [ ] [ ] destSizes ) throws NumberIsTooLargeException { } public int [ ] getPartialDerivativeOrders ( final int index ) { } public int getFreeParameters ( ) { } public int getOrder ( ) { } public int getSize ( ) { } public void linearCombination ( final double a1 , final double [ ] c1 , final int offset1 , final double a2 , final double [ ] c2 , final int offset2 , final double [ ] result , final int resultOffset ) { } public void linearCombination ( final double a1 , final double [ ] c1 , final int offset1 , final double a2 , final double [ ] c2 , final int offset2 , final double a3 , final double [ ] c3 , final int offset3 , final double [ ] result , final int resultOffset ) { }

Fix:
List < int [ ] > row = new ArrayList < int [ ] > ( ( ( dRow . length ) * 2 ) ) ;