fork(1) download
  1. class HelloWorld {
  2. public static void main(String[] args) {
  3. String[] vetor = {"aaa", "aaa", "aaa", "bbb", "bbb", "bbb", "ccc", "ccc", "ccc", "ddd", "ddd", "ddd"};
  4. String[] novoVetor = new String[vetor.length / 3];
  5. for (int i = 0; i < vetor.length; i += 3) {
  6. novoVetor[i / 3] = vetor[i] + vetor[i + 1] + vetor[i + 2];
  7. }
  8. for (String item : novoVetor) {
  9. System.out.println(item);
  10. }
  11. }
  12. }
Success #stdin #stdout 0.05s 711168KB
stdin
Standard input is empty
stdout
aaaaaaaaa
bbbbbbbbb
ccccccccc
ddddddddd