fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. String result = "3;4;7";
  13. ArrayList<Integer> servs = new ArrayList<Integer>();
  14. String[] aux = result.split(";");
  15. for (int i =0; i< aux.length; i++)
  16. {
  17. servs.add( Integer.parseInt(aux[i]) );
  18. }
  19. System.out.println("The ArrayList Items "+ servs);
  20. System.out.println("The size of ArrayList is: " + servs.size());
  21. System.out.println("The size of the Array is: " + aux.length);
  22. }
  23. }
Success #stdin #stdout 0.09s 320320KB
stdin
Standard input is empty
stdout
The ArrayList Items [3, 4, 7]
The size of ArrayList is: 3
The size of the Array is: 3