Interactive Nim Game This my first java program. I wrote this as a Nim Game so that I could learn java while writing it. I would love to see how could this be made better.
Sample Game:

Code:
import java.util.Scanner;

public class Nim {

  public static boolean isArrayZero(int[] arr){
    for(int i: arr){
      if(i &gt; 0)
      return false;
    }
    return true;
  }

  public static int getPile(char pile){
    switch (pile) {
      case 'A': return 0;
      case 'B': return 1;
      case 'C': return 2;
      default:  return -1;

    }
  }
  public static String playerTurn(String pl1, String pl2, int nbOfTurns){
    if(nbOfTurns % 2 == 0)
       return pl1;
       return pl2;
  }
  public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    String player1, player2, player;
    int[] pile = {3,5,7};
    int pileNb, howMany = 0, chosenPile = 0, nbOfTurns = 0;
    char pileName;
    //Get names of players
    System.out.print(&quot;Player1 name: &quot;);
    player1 = input.next();

    System.out.print(&quot;Player2 name: &quot;);
    player2 = input.next();


    do {
      System.out.println(String.format(&quot;\nA:%s\tB:%s\tC: %s&quot;, pile[0], pile[1], pile[2]) );
      player = playerTurn(player1, player2, nbOfTurns);
      do{
          System.out.print(String.format(&quot;\n%s,Choose a pile: &quot;, player));
          pileName = Character.toUpperCase(input.next().charAt(0));
          pileNb = getPile(pileName);
          if(pileNb == -1)
            continue;
          chosenPile = pile[pileNb];
          if(chosenPile == 0)
            continue;
          System.out.println(String.format(&quot;How many to remove from pile %s&quot;, pileName));
          howMany = input.nextInt();
      }while((howMany &gt; chosenPile) || (howMany &lt;= 0));
      pile[pileNb] = chosenPile - howMany;
      nbOfTurns += 1;
    } while (!isArrayZero(pile));
    System.out.println(String.format(&quot;%s, You loose&quot;, player) );
  }
}
Checking arrays

Since you are in Java 8, you can use IntStream to help you out:

public static boolean isArrayZero(int[] arr){
    return Arrays.stream(arr).allMatch(i -&gt; i &lt;= 0);
}


What that means is to ensure all matches the IntPredicate (lambda) i &lt;= 0.

Input validation

Your input validation can probably be better done as a method:

private static int getPile(Scanner scanner) {
    int result = -1;
    while (result = -1) {
        result = getPile(Character.toUpperCase(input.next().charAt(0)));
    }
    return result;
}


And the same goes for asking the number to remove from the pile. These can be done to eliminate the need to continue from the loop.

Modeling

Using an int[] array is perfectly fine, but you may also want to explore other forms of modeling, such as using an enum:

enum Pile {
    A, B, C;

    public static Pile getPile(char input) {
        try {
            return valueOf(String.valueOf(input));
        } catch (IllegalArgumentException e) {
            return null;
        }
    }
}


Instead of dealing with array indices, you then deal with enum values, which depending on your perspective may look a little better.

try-with-resources

The usage of try-with-resources on the Scanner instance is recommended to manage its underlying I/O resource cleanly.

Potential bug

The screenshot you currently have does not agree with your code, since it looks like Mark managed to remove 8 from 7 in pile 'C'. The same prompts confused me here... Maybe use a prompt that indicates an invalid input was encountered will be a bit better.