title: Given that an Object is an Array of any type how do you test that it is empty in Java?
body: <p>Please help me complete my isEmpty method:</p>
  
  <pre><code>public static boolean isEmpty(Object test){
      if (test==null){
          return true;
      }
      if (test.getClass().isArray()){
          //???
      }
      if (test instanceof String){
          String s=(String)test;
          return s=="";
      }
      if (test instanceof Collection){
          Collection c=(Collection)test;
          return c.size()==0;
      }
      return false;
  }
  </code></pre>
  
  <p>What code would I put int to establish that if I am dealing with an array it will return true if it's length is zero?  I want it to work no matter the type whether it is int[], Object[]. (Just so you know, I can tell you that if you put an int[] into an Object[] variable, it will throw an exception.)</p>