> For the complete documentation index, see [llms.txt](https://tomthestrom.gitbook.io/cs61b-fall-2022/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tomthestrom.gitbook.io/cs61b-fall-2022/lab-01-setting-up-your-computer.md).

# Lab 01: Setting up your computer

Instructions: <https://fa22.datastructur.es/materials/lab/lab01/>

Solution: <https://github.com/tomthestrom/cs61b/tree/master/lab01>

A lot of reading about setting everything up, then you're encouraged to implement the `int nextNumber` method in `Collatz` and make `bool isLeapYear` return true, optionally implementing it.

Easy tasks to make sure everything's working as it's supposed to.

### Solutions:

```java
public static int nextNumber(int n) {
    if (n == 1) {
        return 1;
    } else if (n % 2 == 1) {
        return (3 * n) + 1;
    } else {
        return n / 2;
    }
}
```

```java
public static boolean isLeapYear(int year) {
    // Optional
    return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);
}
```
