Here you can find the source of getIntArray(JsonObject object, String name)
public static int[] getIntArray(JsonObject object, String name)
//package com.java2s; //License from project: Open Source License import javax.json.JsonArray; import javax.json.JsonNumber; import javax.json.JsonObject; import javax.json.JsonValue; public class Main { public static int[] getIntArray(JsonObject object, String name) { return toIntArray(getJsonArray(object, name)); }//from w w w . ja v a 2 s .c o m public static int[] toIntArray(JsonArray jsonArray) { if (jsonArray == null) return new int[0]; int[] ret = new int[jsonArray.size()]; for (int i = 0; i < jsonArray.size(); i++) { ret[i] = ((JsonNumber) jsonArray.get(i)).intValue(); } return ret; } public static JsonArray getJsonArray(JsonObject object, String name) { if (hasKey(object, name)) { return object.getJsonArray(name); } return null; } public static JsonArray getJsonArray(JsonArray object, int index) { if (object == null) return null; if (object.size() <= index) return null; JsonValue value = object.get(index); if ((value == null) || (value == JsonValue.NULL)) { return null; } return object.getJsonArray(index); } public static boolean hasKey(JsonObject object, String name) { JsonValue value = object.get(name); if ((value == null) || (value == JsonValue.NULL)) { return false; } return true; } }