title: How to convert POJO values to object array
body: <p>I have pojo class as; </p>
  
  <pre><code>public class Person {
      private int id;
      private String name;
      private String address;
      private int salary;
      // getter and setter
  }
  </code></pre>
  
  <p>I want to convert value of this pojo class object to object array as;</p>
  
  <pre><code>Object[] perObjArray = new Object[4];
  empObjArray[0] = personObjcet.getId();
  empObjArray[1] = personObjcet.getName();
  empObjArray[2] = personObjcet.getAddress();
  empObjArray[3] = personObjcet.getSalary();
  </code></pre>
  
  <p>Like this scenario, i have other pojo classes. I want to create generic method where i can pass pojo object and it will return object array of those values. </p>
  
  <p>I know we can use reflection, but not sure how ? Please help..</p>