import java.util.Random;

/**
 * Cumul de nombres.
 */
public class Main {
  private final static int MAX = 6;

  public static void main(String[] args) {
    int[] t = new int[10];
    // Le générateur de nombres aléatoires
    Random random = new Random();
    // Initialisation des valeurs du tableau
    for (int i = 0; i < t.length; i++) {
      t[i] = random.nextInt(MAX) + 1;
    }
    // Parcours du tableau
    int somme = 0;
    for (int v : t) {
      if (v == 6) break;
      if (v < 3) {
          somme += v;
      }
    }
    // Affichage des résultats
    for (int v : t) {
      System.out.print(v + "; ");
    }
    System.out.println();
    System.out.println("La somme est égale à " + somme);
  }

}