Java Arrays toString Float


Java Arrays toString Float

package com.codingdict;

import java.util.Arrays;

public class ArrayDemo {
   public static void main(String[] args) {

      // initializing float array
      float[] f1 = new float[] { 1.2f, 9.7f, 3.4f };

      // let us print all the elements available in list
      System.out.println("The array is:");
      for (float number : f1) {
         System.out.println("Number = " + number);
      }

      System.out.println("The string representation of array is:");
      System.out.println(Arrays.toString(f1));    
   }
}