[Demonstration 1]

[Buggy Method]
public int[] invertida() {
    for (int i = this.lista.length - 1; i >= 0; i--) {
        this.lista[i] = (int) (i);
    }
    return this.lista;
}

[Buggy Hunk]
this.lista[i] = (int) (i);

[Patch]
this.lista[this.lista.length - i - 1] = (int) (i);

[Demonstration 2]

[Buggy Method]
private boolean placeShips(GameModel game, int playerNumber) {
    // Get the player's table of ships and game grid
    Hashtable<String, Ship> ships;
    Player player;
    if (playerNumber == 1) {
        player = game.getPlayer1();
        ships = player.getShips();
    } else if (playerNumber == 2) {
        player = game.getPlayer2();
        ships = player.getShips();
    } else {
        // Return false if an invalid player number is provided
        return false;
    }
    // Iterate through the Hashtable of ships to place them
    Set<String> keys = ships.keySet();
    for (String key : keys) {
        Ship currentShip = ships.get(key);
        int length = currentShip.getHits();
        // Select a random number 0-1 to determine orientation of ship
        Random rand = new Random();
        int orientation = rand.nextInt(2);
        // Loop picking random locations until we find one that is not already occupied
        while (true) {
            Point[] currentPoints = new Point[length];
            if (orientation == 0) {
                // Horizontal orientation
                // Select a random starting point
                // subtract the length so it won't overflow the board
                int x = rand.nextInt(10 - length);
                int y = rand.nextInt(10);
                // Create points
                for (int i = 0; i < length; i++) {
                    currentPoints[i] = new Point(x + i, y, false);
                }
            } else {
                // Vertical orientation
                // Select a random starting point
                int x = rand.nextInt(10);
                // subtract the length so it won't overflow the board
                int y = rand.nextInt(10 - length);
                // Create points
                for (int i = 0; i < length; i++) {
                    currentPoints[i] = new Point(x, y + i, false);
                }
            }
            // Check if there is already a ship in this location
            boolean shipOverlaps = false;
            for (Point p : currentPoints) {
                shipOverlaps = player.hasShipOnPoint(p);
                // stop checking if we already know one overlaps
                if (shipOverlaps)
                    break;
            }
            // If no ships overlap, set the location for this ship
            // Otherwise, while loop will restart
            if (shipOverlaps == false) {
                currentShip.setLocation(new Location(currentPoints));
                break;
            }
        }
    }
    return true;
}

[Buggy Hunk]
int length = currentShip.getHits();

[Patch]
int length = ((Ship) currentShip).getHits();

[Demonstration 3]

[Buggy Method]
public void print() {
    objectList.add(background);
    rankingTable = new RankingTable();
    // Sort data by difference of wins and losses.
    database.sortByDifference();
    Vector<PlayerScore> data = database.getData();
    int size = data.size();
    if (size > 0) {
        Iterator<PlayerScore> iterator = data.iterator();
        rankingTable.drawHeader();
        int index = 0;
        while (iterator.hasNext()) {
            ++index;
            PlayerScore player = iterator.next();
            int numOfWins = player.getNumOfWins();
            int numOfLosses = player.getNumOfLosses();
            int diff = numOfWins - numOfLosses;
            rankingTable.drawPlayerScore(index + ". " + player.getUsername(), numOfWins, numOfLosses, diff);
        }
    } else {
        rankingTable.drawNoRecords();
    }
    objectList.add(rankingTable);
}

[Buggy Hunk]
while(iterator.hasNext()){

[Patch]
while(iterator.hasNext() && index < 5){