title: How to convert hash Set into array using toArray() if the method toArray is not specified?
body: <p>Looking at the java api for java collections framework, I could not find toArray() method in HashSet, there is toArray() method in abstract class Set. </p>
  
  <pre><code>class Ideone {
      public static void main (String[] args) throws java.lang.Exception {
          Set x = new HashSet();
          x.add(4);
          //ArrayList&lt;Integer&gt; y = x.toArray(); this does not work !
          int[] y = x.toArray();//this does not work!
  
          System.out.println(x.toArray());//this gives some weird stuff printed : Ljava.lang.Object;@106d69c
      }
  }
  </code></pre>
  
  <p>How do I convert hashset into array if there is no toArray() specified?</p>