集册 Java实例教程 将双数组转换为浮点数组

将双数组转换为浮点数组

欢马劈雪     最近更新时间:2020-01-02 10:19:05

508
将双数组转换为浮点数组


import java.util.Collection;

import java.util.Iterator;

import java.util.Map;
/**
 * 时   代    Java - nowjava.com 提 供 
**/

import java.util.function.Predicate;


public class Main{

    public static void main(String[] argv){

        double[] doubleArray = new int[]{34.45,35.45,36.67,37.78,37.0000,37.1234,67.2344,68.34534,69.87700};

        System.out.println(java.util.Arrays.toString(toFloatArray(doubleArray)));

    }

    static float[] toFloatArray(final double[] doubleArray) {

    if (doubleArray == null) {

      return null;

    } else {/*来自 n o w  j a v a  . c o m*/

      final int size = doubleArray.length;

      final float[] floatArray = new float[siz
展开阅读全文