JSONArray array = new JSONArray(); array.put("apple"); array.put("banana"); array.put("orange"); System.out.println(array.toString());
JSONArray array = new JSONArray("[1, 2, 3]"); int firstElement = array.getInt(0); int secondElement = array.getInt(1); int thirdElement = array.getInt(2); System.out.println(firstElement + secondElement + thirdElement);This code creates a JSONArray object from a string containing a JSON array of integers, accesses the first three elements of the array using the `getInt()` method, and then prints the sum of the elements. The package library for the java org.json JSONArray is `org.json`.