Source Code : Convert array of primitives into array of objects

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

Convert array of primitives into array of objects

     

import org.apache.commons.lang.ArrayUtils;

public class Main {
  public static void main(String[] args) {
    int numbers[] = { 1, 2, 3, 4, 5 };
    boolean bools[] = { true, false, false, true };
    float decimals[] = { 10.1f, 3.14f, 2.17f };

    Integer numbersObj[] = ArrayUtils.toObject(numbers);
    Boolean boolsObj[] = ArrayUtils.toObject(bools);
    Float decimalsObj[] = ArrayUtils.toObject(decimals);
  }
}
 

   
    
    
    
    
  

Thank with us