/** * Create a string representation of the given array, as a matrix, * interpreting it as a matrix that is stored in column-major order. The * given array may be <code>null</code>. If it is not <code>null</code>, * then it must either have 3x3 elements or 4x4 elements. <br> * <br> * The individual elements of the matrix will be formatted (in an * unspecified way) so that the matrix entries are aligned. * * @param array The array * @return The string representation */ public static String createFormattedMatrixString(float array[]) { if (array == null) { return "null"; } String format = "%10.5f "; if (array.length == 9) { return createFormattedMatrixString(array, 3, 3, format); } if (array.length == 16) { return createFormattedMatrixString(array, 4, 4, format); } return "WARNING: Not a matrix: "+Arrays.toString(array); }