Java Scanner Read loadDoubleArray(Scanner reader)

Here you can find the source of loadDoubleArray(Scanner reader)

Description

load Double Array

License

Open Source License

Declaration

public static double[] loadDoubleArray(Scanner reader) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Scanner;

public class Main {
    public static double[] loadDoubleArray(Scanner reader) {
        int dim = reader.nextInt();
        double[] ret = new double[dim];
        for (int i = 0; i < dim; i++) {
            ret[i] = Double.parseDouble(reader.next());
        }// ww w  .  j  a  v  a2  s  . c o m
        return ret;
    }

    public static double[] loadDoubleArray(Scanner reader, int size) {
        double[] ret = new double[size];
        for (int i = 0; i < size; i++) {
            ret[i] = Double.parseDouble(reader.next());
        }
        return ret;
    }
}

Related

  1. load(final String fileName)
  2. load(InputStream in, int elementCountOverride)
  3. loadAWSCredentails(String file_path)
  4. loadBooleanArray(BufferedReader in)
  5. loadConf()
  6. loadDoubleMatrix(Scanner reader)
  7. loadIntArray(Scanner reader)
  8. loadNDimDoubleMatrix(Scanner reader, int numberOfDim, Object nmatrix)
  9. loadNDimDoubleMatrixRec(Scanner reader, int[] dim, Object nmatrix)