import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
    public static void main(String[] args) {
      int[] first = {10,20,30,40,50};
      List newArr = new ArrayList();
      for(int i=0;i<first.length;i++){
          if(i%2 == 0){
          newArr.add(first[i] - 1);
          }
      }
      System.out.println(newArr.toString());
    }
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: