List of usage examples for java.lang Float NaN
float NaN
To view the source code for java.lang Float NaN.
Click Source Link
From source file:org.eclipse.january.dataset.ComplexFloatDataset.java
@Override public ComplexFloatDataset idivide(final Object b) { setDirty();/* w ww .jav a2 s . c om*/ Dataset bds = b instanceof Dataset ? (Dataset) b : DatasetFactory.createFromObject(b); boolean useLong = bds.getElementClass().equals(Long.class); if (bds.getSize() == 1) { final IndexIterator it = getIterator(); if (useLong) { // note no complex longs final long r2 = bds.getElementLongAbs(0); while (it.hasNext()) { data[it.index] /= r2; data[it.index + 1] /= r2; } } else { final double r2 = bds.getElementDoubleAbs(0); if (!bds.isComplex() || bds.getElementDoubleAbs(1) == 0) { while (it.hasNext()) { data[it.index] /= r2; data[it.index + 1] /= r2; } } else { final double i2 = bds.getElementDoubleAbs(1); if (Math.abs(r2) < Math.abs(i2)) { double q = r2 / i2; double den = r2 * q + i2; while (it.hasNext()) { double r1 = data[it.index]; double i1 = data[it.index + 1]; data[it.index] = (float) ((r1 * q + i1) / den); // ADD_CAST data[it.index + 1] = (float) ((i1 * q - r1) / den); // ADD_CAST } } else { double q = i2 / r2; double den = i2 * q + r2; if (den == 0) { while (it.hasNext()) { data[it.index] = Float.NaN; // CLASS_TYPE data[it.index + 1] = Float.NaN; // CLASS_TYPE } } else { while (it.hasNext()) { double r1 = data[it.index]; double i1 = data[it.index + 1]; data[it.index] = (float) ((i1 * q + r1) / den); // ADD_CAST data[it.index + 1] = (float) ((i1 - r1 * q) / den); // ADD_CAST } } } } } } else { final BroadcastIterator it = BroadcastIterator.createIterator(this, bds); it.setOutputDouble(!useLong); if (useLong) { while (it.hasNext()) { data[it.aIndex] /= it.bLong; data[it.aIndex + 1] /= it.bLong; } } else { if (bds.isComplex()) { while (it.hasNext()) { double r1 = it.aDouble; double r2 = it.bDouble; double i1 = data[it.aIndex + 1]; double i2 = bds.getElementDoubleAbs(it.bIndex + 1); if (Math.abs(r2) < Math.abs(i2)) { double q = r2 / i2; double den = r2 * q + i2; data[it.aIndex] = (float) ((r1 * q + i1) / den); // ADD_CAST data[it.aIndex + 1] = (float) ((i1 * q - r1) / den); // ADD_CAST } else { double q = i2 / r2; double den = i2 * q + r2; if (den == 0) { data[it.aIndex] = Float.NaN; // CLASS_TYPE data[it.aIndex + 1] = Float.NaN; // CLASS_TYPE } else { data[it.aIndex] = (float) ((i1 * q + r1) / den); // ADD_CAST data[it.aIndex + 1] = (float) ((i1 - r1 * q) / den); // ADD_CAST } } } } else { while (it.hasNext()) { data[it.aIndex] /= it.bDouble; data[it.aIndex + 1] /= it.bDouble; } } } } return this; }
From source file:org.kalypsodeegree_impl.graphics.displayelements.RasterDisplayElement_Impl.java
private float getOpacity() throws FilterEvaluationException { final RasterSymbolizer symbolizer = (RasterSymbolizer) getSymbolizer(); final ParameterValueType opacity = symbolizer.getOpacity(); if (opacity == null) return Float.NaN; final String evaluate = opacity.evaluate(getFeature()); final float opacityValue = DatatypeConverter.parseFloat(evaluate); return opacityValue; }
From source file:com.hippo.largeimageview.LargeImageView.java
@CheckResult private static float norm(float start, float stop, float value) { if (stop == start) { if (stop == value) { return 1.0f; } else {/*from ww w . ja v a 2 s. c o m*/ return Float.NaN; } } else { return (value - start) / (stop - start); } }
From source file:org.stockchart.StockChartView.java
private float getAreaAutoHeightInPixels() { int autoAreaCount = 0; final float totalHeight = this.getHeight(); float remainingHeight = totalHeight; for (Area a : fAreas) { if (!a.isVisible()) continue; if (a.isAutoHeight()) autoAreaCount++;/*from www. j a v a2 s .co m*/ else remainingHeight -= a.getHeightInPercents() * totalHeight; } if (0 == autoAreaCount) return Float.NaN; if (remainingHeight < 0) return 0f; return (float) remainingHeight / (float) autoAreaCount; }
From source file:com.yahoo.egads.models.tsmm.TestOlympicModel2.java
@Test public void train() throws Exception { OlympicModel2 model = new OlympicModel2(config); TimeSeries ts = new TimeSeries(); ts.append(1475452800, 10);/*from w ww . j av a2s. co m*/ ts.append(1475453100, 25); ts.append(1476057600, 20); ts.append(1476057900, 45); ts.append(1476662400, 30); ts.append(1476662700, 55); ts.append(1477267200, 40); ts.append(1477267500, 65); model.train(ts.data); assertEquals(13, model.model.size()); assertEquals(1477872000, (long) model.model.get(0).getKey()); assertEquals(25.0, model.model.get(0).getValue(), 0.00001); assertEquals(1477872300, (long) model.model.get(1).getKey()); assertEquals(47.5, model.model.get(1).getValue(), 0.00001); assertEquals(1477872600, (long) model.model.get(2).getKey()); assertTrue(Double.isNaN(model.model.get(2).getValue())); // missing first point ts = new TimeSeries(); //ts.append(1475452800, 10); ts.append(1475453100, 25); ts.append(1476057600, 20); ts.append(1476057900, 45); ts.append(1476662400, 30); ts.append(1476662700, 55); ts.append(1477267200, 40); ts.append(1477267500, 65); model.reset(); model.train(ts.data); assertEquals(13, model.model.size()); assertEquals(1477872000, (long) model.model.get(0).getKey()); assertEquals(30.0, model.model.get(0).getValue(), 0.00001); assertEquals(1477872300, (long) model.model.get(1).getKey()); assertEquals(47.5, model.model.get(1).getValue(), 0.00001); assertEquals(1477872600, (long) model.model.get(2).getKey()); assertTrue(Double.isNaN(model.model.get(2).getValue())); // missing first window ts = new TimeSeries(); //ts.append(1475452800, 10); //ts.append(1475453100, 25); ts.append(1476057600, 20); ts.append(1476057900, 45); ts.append(1476662400, 30); ts.append(1476662700, 55); ts.append(1477267200, 40); ts.append(1477267500, 65); model.reset(); model.train(ts.data); assertEquals(13, model.model.size()); assertEquals(1477872000, (long) model.model.get(0).getKey()); assertEquals(30.0, model.model.get(0).getValue(), 0.00001); assertEquals(1477872300, (long) model.model.get(1).getKey()); assertEquals(55.0, model.model.get(1).getValue(), 0.00001); assertEquals(1477872600, (long) model.model.get(2).getKey()); assertTrue(Double.isNaN(model.model.get(2).getValue())); // missing last dp ts = new TimeSeries(); ts.append(1475452800, 10); ts.append(1475453100, 25); ts.append(1476057600, 20); ts.append(1476057900, 45); ts.append(1476662400, 30); ts.append(1476662700, 55); ts.append(1477267200, 40); //ts.append(1477267500, 65); model.reset(); model.train(ts.data); assertEquals(13, model.model.size()); assertEquals(1477872000, (long) model.model.get(0).getKey()); assertEquals(25.0, model.model.get(0).getValue(), 0.00001); assertEquals(1477872300, (long) model.model.get(1).getKey()); assertEquals(41.66666, model.model.get(1).getValue(), 0.00001); assertEquals(1477872600, (long) model.model.get(2).getKey()); assertTrue(Double.isNaN(model.model.get(2).getValue())); // missing last window ts = new TimeSeries(); ts.append(1475452800, 10); ts.append(1475453100, 25); ts.append(1476057600, 20); ts.append(1476057900, 45); ts.append(1476662400, 30); ts.append(1476662700, 55); //ts.append(1477267200, 40); //ts.append(1477267500, 65); model.reset(); model.train(ts.data); assertEquals(13, model.model.size()); assertEquals(1477872000, (long) model.model.get(0).getKey()); assertEquals(20.0, model.model.get(0).getValue(), 0.00001); assertEquals(1477872300, (long) model.model.get(1).getKey()); assertEquals(41.66666, model.model.get(1).getValue(), 0.00001); assertEquals(1477872600, (long) model.model.get(2).getKey()); assertTrue(Double.isNaN(model.model.get(2).getValue())); // missing middle DP ts = new TimeSeries(); ts.append(1475452800, 10); ts.append(1475453100, 25); ts.append(1476057600, 20); ts.append(1476057900, 45); //ts.append(1476662400, 30); ts.append(1476662700, 55); ts.append(1477267200, 40); ts.append(1477267500, 65); model.reset(); model.train(ts.data); assertEquals(13, model.model.size()); assertEquals(1477872000, (long) model.model.get(0).getKey()); assertEquals(23.33333, model.model.get(0).getValue(), 0.00001); assertEquals(1477872300, (long) model.model.get(1).getKey()); assertEquals(47.5, model.model.get(1).getValue(), 0.00001); assertEquals(1477872600, (long) model.model.get(2).getKey()); assertTrue(Double.isNaN(model.model.get(2).getValue())); // missing middle window ts = new TimeSeries(); ts.append(1475452800, 10); ts.append(1475453100, 25); ts.append(1476057600, 20); ts.append(1476057900, 45); //ts.append(1476662400, 30); //ts.append(1476662700, 55); ts.append(1477267200, 40); ts.append(1477267500, 65); model.reset(); model.train(ts.data); assertEquals(13, model.model.size()); assertEquals(1477872000, (long) model.model.get(0).getKey()); assertEquals(23.33333, model.model.get(0).getValue(), 0.00001); assertEquals(1477872300, (long) model.model.get(1).getKey()); assertEquals(45.0, model.model.get(1).getValue(), 0.00001); assertEquals(1477872600, (long) model.model.get(2).getKey()); assertTrue(Double.isNaN(model.model.get(2).getValue())); // only one window ts = new TimeSeries(); //ts.append(1475452800, 10); //ts.append(1475453100, 25); ts.append(1476057600, 20); ts.append(1476057900, 45); //ts.append(1476662400, 30); //ts.append(1476662700, 55); //ts.append(1477267200, 40); //ts.append(1477267500, 65); model.reset(); model.train(ts.data); assertEquals(13, model.model.size()); assertEquals(1477872000, (long) model.model.get(0).getKey()); assertEquals(20.0, model.model.get(0).getValue(), 0.00001); assertEquals(1477872300, (long) model.model.get(1).getKey()); assertEquals(45.0, model.model.get(1).getValue(), 0.00001); assertEquals(1477872600, (long) model.model.get(2).getKey()); assertTrue(Double.isNaN(model.model.get(2).getValue())); // Off by a second ts = new TimeSeries(); //ts.append(1475452800, 10); //ts.append(1475453100, 25); ts.append(1476057599, 20); ts.append(1476057900, 45); //ts.append(1476662400, 30); //ts.append(1476662700, 55); //ts.append(1477267200, 40); //ts.append(1477267500, 65); model.reset(); model.train(ts.data); assertEquals(13, model.model.size()); assertEquals(1477872000, (long) model.model.get(0).getKey()); assertTrue(Double.isNaN(model.model.get(0).getValue())); assertEquals(1477872300, (long) model.model.get(1).getKey()); assertEquals(45.0, model.model.get(1).getValue(), 0.00001); assertEquals(1477872600, (long) model.model.get(2).getKey()); assertTrue(Double.isNaN(model.model.get(2).getValue())); // data earlier than the first window ts = new TimeSeries(); ts.append(1474243200, 10); ts.append(1474243500, 25); ts.append(1474848000, 20); ts.append(1474848300, 45); model.initializeIndices(ts.data, start); assertEquals(13, model.model.size()); assertEquals(1477872000, (long) model.model.get(0).getKey()); assertTrue(Double.isNaN(model.model.get(0).getValue())); assertEquals(1477872300, (long) model.model.get(1).getKey()); assertEquals(45.0, model.model.get(1).getValue(), 0.00001); assertEquals(1477872600, (long) model.model.get(2).getKey()); assertTrue(Double.isNaN(model.model.get(2).getValue())); // data later than the first window ts = new TimeSeries(); ts.append(1477872000, 10); ts.append(1477872300, 25); ts.append(1478476800, 20); ts.append(1478477000, 45); model.reset(); model.train(ts.data); assertEquals(13, model.model.size()); assertEquals(1477872000, (long) model.model.get(0).getKey()); assertTrue(Double.isNaN(model.model.get(0).getValue())); assertEquals(1477872300, (long) model.model.get(1).getKey()); assertTrue(Double.isNaN(model.model.get(1).getValue())); assertEquals(1477872600, (long) model.model.get(2).getKey()); assertTrue(Double.isNaN(model.model.get(2).getValue())); // NaNs ts = new TimeSeries(); ts.append(1475452800, Float.NaN); ts.append(1475453100, 25); ts.append(1476057600, Float.NaN); ts.append(1476057900, 45); ts.append(1476662400, Float.NaN); ts.append(1476662700, 55); ts.append(1477267200, Float.NaN); ts.append(1477267500, 65); model.reset(); model.train(ts.data); assertEquals(13, model.model.size()); assertEquals(1477872000, (long) model.model.get(0).getKey()); assertTrue(Double.isNaN(model.model.get(0).getValue())); assertEquals(1477872300, (long) model.model.get(1).getKey()); assertEquals(47.5, model.model.get(1).getValue(), 0.00001); assertEquals(1477872600, (long) model.model.get(2).getKey()); assertTrue(Double.isNaN(model.model.get(2).getValue())); // irregular spacing ts = new TimeSeries(); ts.append(1475452800, 10); ts.append(1475453100, 25); ts.append(1476057600, 20); ts.append(1476057900, 45); ts.append(1476662400, 30); // avg these three == 15 ts.append(1476662460, 10); ts.append(1476662520, 5); ts.append(1476662700, 55); ts.append(1477267200, 40); ts.append(1477267500, 65); model.reset(); model.train(ts.data); assertEquals(13, model.model.size()); assertEquals(1477872000, (long) model.model.get(0).getKey()); assertEquals(21.25, model.model.get(0).getValue(), 0.00001); assertEquals(1477872300, (long) model.model.get(1).getKey()); assertEquals(47.5, model.model.get(1).getValue(), 0.00001); assertEquals(1477872600, (long) model.model.get(2).getKey()); assertTrue(Double.isNaN(model.model.get(2).getValue())); }
From source file:org.apache.solr.handler.component.QueryComponent.java
@SuppressWarnings("unchecked") private void groupedFinishStage(final ResponseBuilder rb) { // To have same response as non-distributed request. GroupingSpecification groupSpec = rb.getGroupingSpec(); if (rb.mergedTopGroups.isEmpty()) { for (String field : groupSpec.getFields()) { rb.mergedTopGroups.put(field, new TopGroups(null, null, 0, 0, new GroupDocs[] {}, Float.NaN)); }//from w w w.j a v a 2s. co m rb.resultIds = new HashMap<>(); } EndResultTransformer.SolrDocumentSource solrDocumentSource = new EndResultTransformer.SolrDocumentSource() { @Override public SolrDocument retrieve(ScoreDoc doc) { ShardDoc solrDoc = (ShardDoc) doc; return rb.retrievedDocuments.get(solrDoc.id); } }; EndResultTransformer endResultTransformer; if (groupSpec.isMain()) { endResultTransformer = MAIN_END_RESULT_TRANSFORMER; } else if (Grouping.Format.grouped == groupSpec.getResponseFormat()) { endResultTransformer = new GroupedEndResultTransformer(rb.req.getSearcher()); } else if (Grouping.Format.simple == groupSpec.getResponseFormat() && !groupSpec.isMain()) { endResultTransformer = SIMPLE_END_RESULT_TRANSFORMER; } else { return; } Map<String, Object> combinedMap = new LinkedHashMap<>(); combinedMap.putAll(rb.mergedTopGroups); combinedMap.putAll(rb.mergedQueryCommandResults); endResultTransformer.transform(combinedMap, rb, solrDocumentSource); }
From source file:au.org.ala.layers.intersect.Grid.java
/** * Increase sampleEveryNthPoint to return a smaller grid. * * Grid max and min values may be skipped. * * This does not used previously cached data. * * @param sampleEveryNthPoint//from w w w . j a va 2s . c o m * @return */ public float[] getGrid(int sampleEveryNthPoint) { int maxArrayLength = Integer.MAX_VALUE - 10; if (subgrids != null) { //sample points int size = 1000; double[][] points = new double[size * size][2]; int pos = 0; for (int i = 0; i < 1000; i++) { for (int j = 0; j < 1000; j++) { points[pos][0] = xmin + (xmax - xmin) * j / (double) size; points[pos][1] = ymax - (ymax - ymin) * i / (double) size; pos++; } } return getValues3(points, 64); } int length = (nrows / sampleEveryNthPoint) * (ncols); float[] ret = new float[length]; RandomAccessFile afile = null; File f2 = new File(filename + ".GRI"); try { //read of random access file can throw an exception if (!f2.exists()) { afile = new RandomAccessFile(filename + ".gri", "r"); } else { afile = new RandomAccessFile(filename + ".GRI", "r"); } int sz = (int) Math.min(afile.length() / sampleEveryNthPoint / sampleEveryNthPoint, maxArrayLength); sz += 8 - sz % 8; byte[] b = new byte[sz]; long i = 0; long max = 0; int len; while ((len = afile.read(b)) > 0) { ByteBuffer bb = ByteBuffer.wrap(b); if (byteorderLSB) { bb.order(ByteOrder.LITTLE_ENDIAN); } if (datatype.equalsIgnoreCase("UBYTE")) { max += len; max = Math.min(max, ret.length * (long) sampleEveryNthPoint); for (; i < max; i++) { ret[(int) (i / sampleEveryNthPoint)] = bb.get(); if (ret[(int) (i / sampleEveryNthPoint)] < 0) { ret[(int) (i / sampleEveryNthPoint)] += 256; } } } else if (datatype.equalsIgnoreCase("BYTE")) { max += len; max = Math.min(max, ret.length * (long) sampleEveryNthPoint); for (; i < max; i++) { ret[(int) (i / sampleEveryNthPoint)] = bb.get(); } } else if (datatype.equalsIgnoreCase("SHORT")) { max += len / 2; max = Math.min(max, ret.length * (long) sampleEveryNthPoint); for (; i < max; i++) { ret[(int) (i / sampleEveryNthPoint)] = bb.getShort(); } } else if (datatype.equalsIgnoreCase("INT")) { max += len / 4; max = Math.min(max, ret.length * (long) sampleEveryNthPoint); for (; i < max; i++) { ret[(int) (i / sampleEveryNthPoint)] = bb.getInt(); } } else if (datatype.equalsIgnoreCase("LONG")) { max += len / 8; max = Math.min(max, ret.length * (long) sampleEveryNthPoint); for (; i < max; i++) { ret[(int) (i / sampleEveryNthPoint)] = bb.getLong(); } } else if (datatype.equalsIgnoreCase("FLOAT")) { max += len / 4; max = Math.min(max, ret.length * (long) sampleEveryNthPoint); for (; i < max; i++) { ret[(int) (i / sampleEveryNthPoint)] = bb.getFloat(); } } else if (datatype.equalsIgnoreCase("DOUBLE")) { max += len / 8; max = Math.min(max, ret.length * (long) sampleEveryNthPoint); for (; i < max; i++) { ret[(int) (i / (long) sampleEveryNthPoint)] = (float) bb.getDouble(); } } else { // / should not happen; catch anyway... max += len / 4; for (; i < max; i++) { ret[(int) (i / (long) sampleEveryNthPoint)] = Float.NaN; } } } //replace not a number for (i = 0; i < length; i++) { if ((float) ret[(int) i] == (float) nodatavalue) { ret[(int) i] = Float.NaN; } else { ret[(int) i] *= rescale; } } } catch (Exception e) { logger.error("An error has occurred - probably a file error", e); } finally { if (afile != null) { try { afile.close(); } catch (Exception e) { logger.error(e.getMessage(), e); } } } grid_data = ret; return ret; }
From source file:com.esri.squadleader.view.SquadLeaderActivity.java
private void clearDisplayStrings() { mainBinding.setDisplaySpeed(String.format(getString(R.string.display_speed), Float.NaN)); mainBinding.setDisplayLocation(String.format(getString(R.string.display_location), "")); mainBinding.setDisplayHeading(String.format(getString(R.string.display_heading), Float.NaN, "")); }
From source file:org.jboss.bqt.client.xml.XMLQueryVisitationStrategy.java
/** * Consume an XML message and update the specified Float instance. * <br>/*from w ww. ja v a 2 s . c o m*/ * @param object the instance that is to be updated with the XML message data. * @param cellElement the XML element that contains the data * @return the updated instance. * @exception JDOMException if there is an error consuming the message. */ private Object consumeMsg(Float object, Element cellElement) throws JDOMException { // ----------------------- // Process the element ... // ----------------------- String strElement = cellElement.getTextTrim(); Float result; if (strElement.equals("NaN")) { //$NON-NLS-1$ result = new Float(Float.NaN); } else if (strElement.equals("-Infinity")) { //$NON-NLS-1$ result = new Float(Float.NEGATIVE_INFINITY); } else if (strElement.equals("Infinity")) { //$NON-NLS-1$ result = new Float(Float.POSITIVE_INFINITY); } else { try { result = Float.valueOf(strElement); } catch (NumberFormatException e) { throw new JDOMException("Unable to parse the value for " + cellElement.getName() + //$NON-NLS-1$ " element: " + strElement, e); //$NON-NLS-1$ } } return result; }
From source file:org.apache.axis2.databinding.utils.ConverterUtil.java
/** * @param baseArrayClass//ww w . j a v a2 s . c o m * @param objectList -> for primitive type array conversion we assume the content to be * strings! * @return Returns Object. */ public static Object convertToArray(Class baseArrayClass, List objectList) { int listSize = objectList.size(); Object returnArray = null; if (int.class.equals(baseArrayClass)) { int[] array = new int[listSize]; for (int i = 0; i < listSize; i++) { Object o = objectList.get(i); if (o != null) { array[i] = Integer.parseInt(o.toString()); } else { array[i] = Integer.MIN_VALUE; } } returnArray = array; } else if (float.class.equals(baseArrayClass)) { float[] array = new float[listSize]; for (int i = 0; i < listSize; i++) { Object o = objectList.get(i); if (o != null) { array[i] = Float.parseFloat(o.toString()); } else { array[i] = Float.NaN; } } returnArray = array; } else if (short.class.equals(baseArrayClass)) { short[] array = new short[listSize]; for (int i = 0; i < listSize; i++) { Object o = objectList.get(i); if (o != null) { array[i] = Short.parseShort(o.toString()); } else { array[i] = Short.MIN_VALUE; } } returnArray = array; } else if (byte.class.equals(baseArrayClass)) { byte[] array = new byte[listSize]; for (int i = 0; i < listSize; i++) { Object o = objectList.get(i); if (o != null) { array[i] = Byte.parseByte(o.toString()); } else { array[i] = Byte.MIN_VALUE; } } returnArray = array; } else if (long.class.equals(baseArrayClass)) { long[] array = new long[listSize]; for (int i = 0; i < listSize; i++) { Object o = objectList.get(i); if (o != null) { array[i] = Long.parseLong(o.toString()); } else { array[i] = Long.MIN_VALUE; } } returnArray = array; } else if (boolean.class.equals(baseArrayClass)) { boolean[] array = new boolean[listSize]; for (int i = 0; i < listSize; i++) { Object o = objectList.get(i); if (o != null) { array[i] = o.toString().equalsIgnoreCase("true"); } } returnArray = array; } else if (char.class.equals(baseArrayClass)) { char[] array = new char[listSize]; for (int i = 0; i < listSize; i++) { Object o = objectList.get(i); if (o != null) { array[i] = o.toString().toCharArray()[0]; } } returnArray = array; } else if (double.class.equals(baseArrayClass)) { double[] array = new double[listSize]; for (int i = 0; i < listSize; i++) { Object o = objectList.get(i); if (o != null) { array[i] = Double.parseDouble(o.toString()); } else { array[i] = Double.NaN; } } returnArray = array; } else if (Calendar.class.equals(baseArrayClass)) { Calendar[] array = new Calendar[listSize]; for (int i = 0; i < listSize; i++) { Object o = objectList.get(i); if (o != null) { if (o instanceof String) { array[i] = ConverterUtil.convertToDateTime(o.toString()); } else if (o instanceof Calendar) { array[i] = (Calendar) o; } } } returnArray = array; } else if (Date.class.equals(baseArrayClass)) { Date[] array = new Date[listSize]; for (int i = 0; i < listSize; i++) { Object o = objectList.get(i); if (o != null) { if (o instanceof String) { array[i] = ConverterUtil.convertToDate(o.toString()); } else if (o instanceof Date) { array[i] = (Date) o; } } } returnArray = array; } else { returnArray = Array.newInstance(baseArrayClass, listSize); ConvertToArbitraryObjectArray(returnArray, baseArrayClass, objectList); } return returnArray; }