Question: I am new to Java game programming, but the more I read the more I'm confused, because I've seen several different approaches to make a game loop:
1. The standard approach, that uses the Timer class (seems to be less precise).
2. The more precise approach that uses System.nanoTime.
3. A simple approach that uses scheduleAtFixedRate.

Which one should generally be preferred and where are the advantages/disadvantages of each approach? Thanks in advance for any info.

Answer: 
I'd just use some simple binary Format, especially if you don't want users to easily edit the file (and also to remove some redundancy).

For example, for a new Trainer you just add the number of Creatures he got.

Then, for every creature, you just add the creature data/stats (assuming they're fixed length or you can determine their length).

From your example above, the first trainer's dataset would just be something like this:

```
5,              12, 1, 3, 4, 6, 13, 1, 2, 5, 13, 1, 4, 5,  11, 1, 3, 5,  16, 1, 2, 7
↑Number of sets ↑ Start of #1    ↑Start of #2 ↑ Start of #3 ↑ Start of #4 ↑ Start of #5

```

Note that these would be bytes rather than actual textual numbers written to the file (might depend on the min/max values as well).
If you want a format that's easy to edit, read and write, XML or JSON are great choices.

**They are not very efficient** - they use a LOT more space than the format you suggested - but they are supported by many tools, and having labels on the fields makes it easy to change the format later without any confusion about what each value means.

example file:

```
{ 
trainers: [
    { "level":5
      pokemons: [
        {"level":12,"attack1":1,"attack2":3,"attack3":4},
        {"level":13,"attack1":1,"attack2":2}
         ]
    }
    { "level":2
      pokemons: [
        {"level":2,"attack1":1,"attack2":2,"attack3":3},
        {"level":2,"attack1":1,"attack2":2,"attack3":3}
         ]
    }
    ]
}

```

Java

```
import java.util.List;

import com.google.gson.Gson;

public class JsonTest {

    public static void main(String[] args) {
        new JsonTest().start();
    }

    private void start() {
        Gson gson = new Gson();

        // Pretend this was read from a file
        String examplePokemonsString = "{ trainers: [{ level:3, pokemons: [{level:3,attack1:1,attack2:2,attack3:3},{level:3,attack1:1,attack2:2,attack3:3}]}]}";

        DataFile data = gson.fromJson(examplePokemonsString, DataFile.class);

        List<Trainer> trainers = data.trainers;
        Trainer firstTrainer = trainers.get(0);
        Pokemon firstPokemon = firstTrainer.pokemons.get(0);
        System.out.println(firstTrainer.pokemons.size()); //This trainer has 2 pokemon
        System.out.println(firstPokemon.level); // First pokemon is at level 3
    }

    class DataFile {

        List<Trainer> trainers;
    }

    class Pokemon {
        int level;
        int attack1;
        int attack2;
        int attack3;
    }

    class Trainer {
        int level;
        List<Pokemon> pokemons;
    }
}

```