public static String representVector(double[] vector, int decimalPlaces) {

		if (vector == null) {

			return "null";

		}

		StringBuilder representation = new StringBuilder();

		int elements = vector.length;

		int elementsLastIndex = elements - 1;

		for (int element = 0; element < elements; element++) {

			// do not perform null check on value because java does not allow
			// the assignment of null to primitives

			double value = vector[element];

			String rounded = new BigDecimal(value)
					.divide(BigDecimal.ONE, decimalPlaces,
							RoundingMode.HALF_EVEN).stripTrailingZeros()
					.toPlainString();

			rounded = rationaliseRepresentation(rounded);

			representation.append(rounded);

			if (element < elementsLastIndex) {

				representation.append(' ');

			}

		}

		return representation.toString();

	}