import java.util.ArrayList;

public class loopHack {
    public static ArrayList<String> iterator (String fullName) {
        for (int i = 0;  i < fullName.length(); i++) {
            char letter = fullName.charAt(i);
            if (letter == ' ') {
                String firstName = fullName.substring(0, i);
                String lastName = fullName.substring(i+1, fullName.length());
                
                ArrayList<String> nameList = new ArrayList<String>(2);
                
                nameList.add(firstName);
                nameList.add(lastName);
                
                return nameList;
            }
        }
        return null;
    }

    public static void main(String[] args) {
        String name = "Vishnu Aravind";
        ArrayList<String> splitName = iterator(name);
        System.out.println(splitName);
    }
}

loopHack.main(null);
[Vishnu, Aravind]

Hack 1

import java.util.ArrayList;

public class numberList {
    private ArrayList<Integer> numbers = new ArrayList<>();

    public void addNumber(int num) {
        numbers.add(num);
    }

    public int getNumberAtIndex(int index) {
        if (index >= 0 && index < numbers.size()) {
            return numbers.get(index);
        } else {
            throw new IndexOutOfBoundsException("Index out of bounds for the ArrayList.");
        }
    }

    public static void main(String[] args) {
        numberList list = new numberList();
        list.addNumber(5);
        list.addNumber(10);
        list.addNumber(15);
        System.out.println(list.getNumberAtIndex(1));
    }
}

numberList.main(null);
10

Hack 2

import java.util.Random;
import java.util.Scanner;

public class guessingGame {

    private int base;
    private int exponent;
    private static final Random random = new Random();

    public guessingGame() {
        this.base = random.nextInt(9) + 2; // Random number between 2 and 10
        this.exponent = random.nextInt(5) - 2; // Random number between -2 and 2 (negative for roots)
    }

    public double getResult() {
        return Math.pow(base, exponent);
    }

    public static String getHint(int exponent) {
        if (exponent == 0) {
            return "Any number raised to the power of 0 is 1!";
        } else if (exponent == 1) {
            return "The number is raised to the power of 1, so it remains unchanged!";
        } else if (exponent > 1) {
            return "The number is raised to a positive power!";
        } else {
            return "The number is under a root!";
        }
    }

    public static void main(String[] args) {
        guessingGame game = new guessingGame();
        Scanner scanner = new Scanner(System.in);

        System.out.println("Welcome to the guessing game!");
        System.out.println("I've taken a number between 2 and 10 and raised it to a power between -2 and 2.");
        System.out.println("Guess the number and its power.");
        System.out.println("Here's the result: " + game.getResult());
        System.out.println("Hint: " + getHint(game.exponent));

        System.out.print("Guess the number: ");
        int guessedBase = scanner.nextInt();

        System.out.print("Guess the exponent: ");
        int guessedExponent = scanner.nextInt();

        if (guessedBase == game.base && guessedExponent == game.exponent) {
            System.out.println("Congratulations! You guessed correctly.");
        } else {
            System.out.println("Sorry, the correct number was " + game.base + " and the exponent was " + game.exponent + ".");
        }

        scanner.close();
    }
}

guessingGame.main(null);
Welcome to the guessing game!
I've taken a number between 2 and 10 and raised it to a power between -2 and 2.
Your task is to guess the number and its power.
Here's the result: 8.0
Hint: The number is raised to the power of 1, so it remains unchanged!
Guess the number: Guess the exponent: Congratulations! You guessed correctly.

Hack 3

import java.util.ArrayList;
import java.util.List;

class Book {
    private String title;
    private String author;
    private double price;
    private int pages;
    private boolean isHardcover;

    public Book(String title, String author, double price, int pages, boolean isHardcover) {
        this.title = title;
        this.author = author;
        this.price = price;
        this.pages = pages;
        this.isHardcover = isHardcover;
    }

    @Override
    public String toString() {
        return "Title: " + title + ", Author: " + author + ", Price: $" + price + ", Pages: " + pages + ", Hardcover: " + isHardcover;
    }

    public static void main(String[] args) {
        List<Book> books = new ArrayList<>();

        books.add(new Book("The Great Gatsby", "F. Scott Fitzgerald", 10.99, 180, true));
        books.add(new Book("1984", "George Orwell", 8.99, 328, false));
        books.add(new Book("To Kill a Mockingbird", "Harper Lee", 12.49, 281, true));
        books.add(new Book("Moby Dick", "Herman Melville", 9.49, 635, false));
        books.add(new Book("Pride and Prejudice", "Jane Austen", 7.99, 279, true));

        // Accessing and displaying information about the books
        for (Book book : books) {
            System.out.println(book);
        }

        // Accessing specific information from a book in the list
        Book firstBook = books.get(0);
        System.out.println("\nTitle of the first book: " + firstBook.title);
        System.out.println("Is the first book hardcover? " + firstBook.isHardcover);
    }
}

Book.main(null);

Title: The Great Gatsby, Author: F. Scott Fitzgerald, Price: $10.99, Pages: 180, Hardcover: true
Title: 1984, Author: George Orwell, Price: $8.99, Pages: 328, Hardcover: false
Title: To Kill a Mockingbird, Author: Harper Lee, Price: $12.49, Pages: 281, Hardcover: true
Title: Moby Dick, Author: Herman Melville, Price: $9.49, Pages: 635, Hardcover: false
Title: Pride and Prejudice, Author: Jane Austen, Price: $7.99, Pages: 279, Hardcover: true

Title of the first book: The Great Gatsby
Is the first book hardcover? true