Buggy code:
public static final int MATCHES_SUB_ON = 2 ; public static final int MATCHES_SUB_OFF = 3 ; public static final int MINUTES_PLAYED = 4 ; public static final int GOALS_SCORED = 5 ; public static final int GOALS_ASSISTED = 6 ; public static final int BOOKED = 7 ; public static final int BOOKED_TWICE = 8 ; public static final int RED_CARDS = 9 ; private Wettbewerb wettbewerb ; private LigaSaison lSeason ; private Gruppe gruppe ; private KORunde startKORunde ; private String kaderFileName ; private int numberOfPlayers ; private ArrayList < Spieler > kader = new ArrayList < > ( ) ; private int [ ] numberOfPlayersByPosition ; private ArrayList < Spieler > eligiblePlayers = new ArrayList < Spieler > ( ) ; private ArrayList < Spieler > ineligiblePlayers = new ArrayList < Spieler > ( ) ; private int lastUpdatedEligibleForDate = - 1 ; private int lastUpdatedIneligibleForDate = - 1 ; private int [ ] currentNumberOfPlayersByPosition ; private boolean playsInLeague = false ; private boolean playsInGroup = false ; public Mannschaft ( int id , Wettbewerb wettbewerb , String mannschaftsDaten ) { } private void initializeArrays ( ) { } public Wettbewerb getWettbewerb ( ) { } public String getPhotoDirectory ( ) { } public int getNumberOfPlayers ( boolean onlyEligible , boolean forceUpdate ) { } public int getNumberOfUsedPlayers ( ) { } public ArrayList < Spieler > getPlayers ( ) { } private void sortPlayers ( ) { } public int getNextFreeSquadNumber ( ) { } public void addPlayer ( Spieler player ) { } public void playerUpdated ( ) { } public void changeSquadNumber ( Spieler player , int newSquadNumber ) { } private void loadKader ( ) { } public void save ( ) { } private void saveKader ( ) { } private void distinguishNames ( ) { } public int getCurrentNumberOf ( Position position ) { } public String getResultOfMatch ( int matchday ) { } public ArrayList < int [ ] > getPerformanceDataMatchByMatch ( Spieler player ) { } public int [ ] getPerformanceData ( Spieler player ) { } public void retrievePerformanceData ( ) { } public int [ ] getFairplayData ( ) { } private void setValuesForMatchday ( int untilMatchday , Tabellenart tabellenart ) { } public int get ( int index , int firstMatchday , int lastMatchday ) { } public int get ( int index , int firstMatchday , int lastMatchday , int includingRank ) { } public String getString ( int index ) { } public int get ( int index , int untilMatchday , Tabellenart tabellenart ) { } public int getSeries ( int index ) { } public int getPlace ( ) { } public void setPlace ( int value ) { } public boolean isSpielEntered ( int matchday ) { } public boolean isErgebnisEntered ( int matchday ) { } public String getName ( ) { } public void setName ( String value ) { } public String getGruendungsdatum ( ) { } public void setGruendungsdatum ( String value ) { } public int getId ( ) { } public int getDeductedPoints ( ) { } public void setDeductedPoints ( int deductedPoints ) { } private void updateEligiblePlayers ( int date , boolean forceUpdate ) { } private void updateIneligiblePlayers ( int date , boolean forceUpdate ) { } public int getCurrentNumberOfPlayers ( int date , boolean forceUpdate ) { } public ArrayList < Spieler > getEligiblePlayers ( int date , boolean forceUpdate ) { } public ArrayList < Spieler > getIneligiblePlayers ( int date , boolean forceUpdate ) { } public Spieler getSpieler ( int squadNumber , int date ) { } public String [ ] getResultsAgainst ( Mannschaft opponent ) { int halfNumberOfMatchesASO = ( wettbewerb . getNumberOfMatchesAgainstSameOpponent ( ) ) // 2 ; <START_BUG> String [ ] results = new String [ 2 * halfNumberOfMatchesASO ] ; <END_BUG> for ( int i = 0 ; i < ( results . length ) ; i ++ ) { results [ i ] = "2;-:-" ; } if ( opponent == ( this ) ) { for ( int i = 0 ; i < ( results . length ) ; i ++ ) { results [ i ] = "2;n//a" ; } } else { int counterH = 0 ; int counterA = 0 ; for ( int i = 0 ; i < ( numberOfMatchdays ) ; i ++ ) { if ( ( daten [ i ] [ Mannschaft . OPPONENT ] ) == ( opponent . getId ( ) ) ) { String result = ( ( daten [ i ] [ Mannschaft . GOALS ] ) + ":" ) + ( daten [ i ] [ Mannschaft . CGOALS ] ) ; if ( ( ergebnisse [ i ] ) != null ) { result = ( ( daten [ i ] [ Mannschaft . POINTS ] ) + ";" ) + result ; } else result = "2;-:-" ; if ( homeaway [ i ] ) results [ ( counterH ++ ) ] = result ; else results [ ( halfNumberOfMatchesASO + ( counterA ++ ) ) ] = result ; } } } return results ; } public String getDateAndTime ( int matchday ) { } public void resetMatch ( int matchday ) { } public void resetGegner ( int matchday ) { } public void setMatch ( int matchday , Spiel spiel ) { } private void setGegner ( int matchday , boolean homeoraway , int opponent ) { } public void setResult ( int matchday , Ergebnis result ) { } private void setResult ( int matchday , int tore , int gegentore ) { } public int [ ] getMatch ( int matchday ) { } public void compareWithOtherTeams ( Mannschaft [ ] otherTeams , int untilMatchday , Tabellenart tabellenart ) { } private void parseString ( String data ) { } public String toString ( ) { }

Fix:
String [ ] results = new String [ wettbewerb . getNumberOfMatchesAgainstSameOpponent ( ) ] ;