code: public static String toFormattedString(LongArrayND array, String format)
      {
          if (array == null)
          {
              return "null";
          }
          StringBuilder sb = new StringBuilder();
          Iterable<MutableIntTuple> iterable = 
              IntTupleIterables.lexicographicalIterable(array.getSize());
          IntTuple previous = null;
          for (IntTuple coordinates : iterable)
          {
              if (previous != null)
              {
                  int c = Utils.countDifferences(previous, coordinates);
                  for (int i=0; i<c-1; i++)
                  {
                      sb.append("\n");
                  }
              }
              long value = array.get(coordinates);
              sb.append(String.format(format+", ", value));
              previous = coordinates;
          }
          return sb.toString();
      }
docs: Creates a formatted representation of the given array. After each
  dimension, a newline character will be inserted.
  
  @param array The array
  @param format The format for the array entries
  @return The hash code