LayerUtil { @VisibleForTesting @NonNull protected Float[] getFloatArray(JSONArray jsonArray) throws JSONException { Float[] lineDashArrayValue = new Float[jsonArray.length()]; for (int i = 0; i < jsonArray.length(); i++) { lineDashArrayValue[i] = Double.valueOf(jsonArray.getDouble(i)).floatValue(); } return lineDashArrayValue; }  @Nullable Layer getLayer(@NonNull String layerJSON); static final String TYPE; static final String ID; static final String SOURCE; static final String SOURCE_LAYER; static final String MINZOOM; static final String MAXZOOM; static final String FILTER; static final String LAYOUT; static final String PAINT; static final String URL; }
@Test public void getFloatArray() throws JSONException { JSONArray jsonArray = new JSONArray("[7, 90, 78, 45, 858, 86, 958]"); Float[] result = layerUtil.getFloatArray(jsonArray); Assert.assertEquals(7, result.length); Assert.assertEquals(7f, result[0]); Assert.assertEquals(90f, result[1]); Assert.assertEquals(958f, result[6]); }