Java Array to String arrayToString(int[] arr)

Here you can find the source of arrayToString(int[] arr)

Description

Convert an array of double that contains accuracy/completeness/correctness into a string (from the 1st..6th elements)

License

Open Source License

Parameter

Parameter Description
df Decimal formatter
arr Array of double (7 elements)

Return

A string of double values

Declaration

public static String arrayToString(int[] arr) 

Method Source Code


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

import java.text.DecimalFormat;

public class Main {
    /**// w  ww. ja va2s.  c om
     * Convert an array of double that contains accuracy/completeness/correctness into a string (from the 1st..6th elements)
     * 
     * @param df Decimal formatter 
     * @param arr Array of double (7 elements)
     * 
     * @return A string of double values
     */
    public static String arrayToString(int[] arr) {
        String result = "[" + arr[0];

        for (int i = 1; i < arr.length; i++)
            result += (";" + arr[i]);

        result += "]";

        return result;
    }

    /**
     * Convert an array of double that contains accuracy/completeness/correctness into a string (from the 1st..6th elements)
     * 
     * @param df Decimal formatter 
     * @param arr Array of double (7 elements)
     * 
     * @return A string of double values
     */
    public static String arrayToString(DecimalFormat df, double[] arr) {
        String result = "[" + df.format(arr[0]);

        for (int i = 1; i < arr.length; i++)
            result += (";" + df.format(arr[i]));

        result += "]";

        return result;
    }
}

Related

  1. arrayToString(float[] a)
  2. arrayToString(float[] arg)
  3. arrayToString(float[][] array)
  4. arrayToString(int[] ar)
  5. arrayToString(int[] arr)
  6. arrayToString(int[] arr)
  7. arrayToString(int[] array)
  8. arrayToString(int[] array)
  9. arrayToString(int[] array)