Solución de Java de selección de actividad

public static void printMaxActivities(int s[], int f[], int n)
    {
    int i, j;
      
    System.out.print("Following activities are selected : n");
    i = 0;
    System.out.print(i+" ");
    for (j = 1; j < n; j++)
    {
         if (s[j] >= f[i])
         {
              System.out.print(j+" ");
              i = j;
          }
     }
    }
Repulsive Raven