Here you can find the source of dumpArray(final float[] array, final int maxElemsPerLine)
Parameter | Description |
---|---|
array | a parameter |
maxElemsPerLine | a parameter |
public static final void dumpArray(final float[] array, final int maxElemsPerLine)
//package com.java2s; public class Main { /**/*from w ww.j a v a 2 s. c o m*/ * Dumps the contents of the given array to stdout. * * @param array * @param maxElemsPerLine */ public static final void dumpArray(final float[] array, final int maxElemsPerLine) { if (array == null) { System.out.println((String) null); return; } int line = 0; System.out.print("[ "); for (int i = 0; i < array.length; i++) { if ((i > 0) && ((i % maxElemsPerLine) == 0)) { System.out.println(); System.out.print(" "); line++; } System.out.print(array[i]); if (i < array.length - 1) { System.out.print(", "); } } if (line > 0) { System.out.println(); System.out.println("]"); } else { System.out.println(" ]"); } } /** * Dumps the contents of the given array to stdout (in one line). * * @param array */ public static final void dumpArray(final float[] array) { dumpArray(array, Integer.MAX_VALUE); } /** * Dumps the contents of the given array to stdout. * * @param array * @param maxElemsPerLine */ public static final void dumpArray(final double[] array, final int maxElemsPerLine) { if (array == null) { System.out.println((String) null); return; } int line = 0; System.out.print("[ "); for (int i = 0; i < array.length; i++) { if ((i > 0) && ((i % maxElemsPerLine) == 0)) { System.out.println(); System.out.print(" "); line++; } System.out.print(array[i]); if (i < array.length - 1) { System.out.print(", "); } } if (line > 0) { System.out.println(); System.out.println("]"); } else { System.out.println(" ]"); } } /** * Dumps the contents of the given array to stdout (in one line). * * @param array */ public static final void dumpArray(final double[] array) { dumpArray(array, Integer.MAX_VALUE); } /** * Dumps the contents of the given array to stdout. * * @param array * @param maxElemsPerLine */ public static final void dumpArray(final int[] array, final int maxElemsPerLine) { if (array == null) { System.out.println((String) null); return; } int line = 0; System.out.print("[ "); for (int i = 0; i < array.length; i++) { if ((i > 0) && ((i % maxElemsPerLine) == 0)) { System.out.println(); System.out.print(" "); line++; } System.out.print(array[i]); if (i < array.length - 1) { System.out.print(", "); } } if (line > 0) { System.out.println(); System.out.println("]"); } else { System.out.println(" ]"); } } /** * Dumps the contents of the given array to stdout (in one line). * * @param array */ public static final void dumpArray(final int[] array) { dumpArray(array, Integer.MAX_VALUE); } /** * Dumps the contents of the given array to stdout. * * @param array * @param maxElemsPerLine */ public static final void dumpArray(final short[] array, final int maxElemsPerLine) { if (array == null) { System.out.println((String) null); return; } int line = 0; System.out.print("[ "); for (int i = 0; i < array.length; i++) { if ((i > 0) && ((i % maxElemsPerLine) == 0)) { System.out.println(); System.out.print(" "); line++; } System.out.print(array[i]); if (i < array.length - 1) { System.out.print(", "); } } if (line > 0) { System.out.println(); System.out.println("]"); } else { System.out.println(" ]"); } } /** * Dumps the contents of the given array to stdout (in one line). * * @param array */ public static final void dumpArray(final short[] array) { dumpArray(array, Integer.MAX_VALUE); } /** * Dumps the contents of the given array to stdout. * * @param array * @param handleLikeUnsigned * @param maxElemsPerLine */ public static final void dumpArray(final byte[] array, boolean handleLikeUnsigned, final int maxElemsPerLine) { if (array == null) { System.out.println((String) null); return; } int line = 0; System.out.print("[ "); for (int i = 0; i < array.length; i++) { if ((i > 0) && ((i % maxElemsPerLine) == 0)) { System.out.println(); System.out.print(" "); line++; } if (handleLikeUnsigned) System.out.print(array[i] & 0xFF); else System.out.print(array[i]); if (i < array.length - 1) { System.out.print(", "); } } if (line > 0) { System.out.println(); System.out.println("]"); } else { System.out.println(" ]"); } } /** * Dumps the contents of the given array to stdout (in one line). * * @param array * @param handleLikeUnsigned */ public static final void dumpArray(final byte[] array, boolean handleLikeUnsigned) { dumpArray(array, handleLikeUnsigned, Integer.MAX_VALUE); } }