Here you can find the source of toDoubleArray(final int[] intArray)
Parameter | Description |
---|---|
intArray | a parameter |
public static double[] toDoubleArray(final int[] intArray)
//package com.java2s; /**// w ww . ja v a 2s. c o m * Copyright (C) [2013] [The FURTHeR Project] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.util.List; import java.util.SortedSet; public class Main { /** * @param set * @return */ public static double[] toDoubleArray(final SortedSet<Integer> set) { final int length = set.size(); final double[] doubleArray = new double[length]; int i = 0; for (final Integer element : set) { doubleArray[i] = element.intValue(); i++; } return doubleArray; } /** * @param intArray * @return */ public static double[] toDoubleArray(final int[] intArray) { final int length = intArray.length; final double[] doubleArray = new double[length]; for (int i = 0; i < intArray.length; i++) { doubleArray[i] = intArray[i]; } return doubleArray; } /** * @param row * @return */ public static double[] toDoubleArray(final List<Double> row) { final int rowSize = row.size(); final double[] rowArray = new double[rowSize]; for (int i = 0; i < rowSize; i++) { rowArray[i] = row.get(i).doubleValue(); } return rowArray; } }