Quaternion implements Serializable { @Override public String toString() { final String sp = " "; final StringBuilder s = new StringBuilder(); s.append("[") .append(q0).append(sp) .append(q1).append(sp) .append(q2).append(sp) .append(q3) .append("]"); return s.toString(); } Quaternion(final double a,
                      final double b,
                      final double c,
                      final double d);  Quaternion(final double scalar,
                      final double[] v);  Quaternion(final double[] v); Quaternion getConjugate(); static Quaternion multiply(final Quaternion q1, final Quaternion q2); Quaternion multiply(final Quaternion q); static Quaternion add(final Quaternion q1,
                                 final Quaternion q2); Quaternion add(final Quaternion q); static Quaternion subtract(final Quaternion q1,
                                      final Quaternion q2); Quaternion subtract(final Quaternion q); static double dotProduct(final Quaternion q1,
                                    final Quaternion q2); double dotProduct(final Quaternion q); double getNorm(); Quaternion normalize(); @Override boolean equals(Object other); @Override int hashCode(); boolean equals(final Quaternion q,
                          final double eps); boolean isUnitQuaternion(double eps); boolean isPureQuaternion(double eps); Quaternion getPositivePolarForm(); Quaternion getInverse(); double getQ0(); double getQ1(); double getQ2(); double getQ3(); double getScalarPart(); double[] getVectorPart(); Quaternion multiply(final double alpha); @Override String toString(); static final Quaternion IDENTITY; static final Quaternion ZERO; static final Quaternion I; static final Quaternion J; static final Quaternion K; }
@Test public final void testToString() { final Quaternion q = new Quaternion(1, 2, 3, 4); Assert.assertTrue(q.toString().equals("[1.0 2.0 3.0 4.0]")); }