集册 Java实例教程 用随机双值填充双数组

用随机双值填充双数组

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

551
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
用随机双值填充双数组


//package com.nowjava;
/*
NowJava.com - 时代Java 提 供
*/


public class Main {

    public static void main(String[] argv) {

        int numberOfItems = 42;

        System.out.println(java.util.Arrays

                .toString(populateDoubleArray(numberOfItems)));

    }


    public static Double[] populateDoubleArray(int numberOfItems) {

        final String partialWord = "partialArrayParallel";

        Double[] dummyDoubleArray = null;

        if (numberOfItems > 0) {

            dummyDoubleArray = new Double[numberOfItems];

            for (int i = 0; i < numberOfItems; i++) {

                final double randomNumber = (Math.rando
展开阅读全文