code: @Override // from IMatrix3
      public Matrix3 invert (Matrix3 result) throws SingularMatrixException {
          float m00 = this.m00, m01 = this.m01, m02 = this.m02;
          float m10 = this.m10, m11 = this.m11, m12 = this.m12;
          float m20 = this.m20, m21 = this.m21, m22 = this.m22;
          // compute the determinant, storing the subdeterminants for later use
          float sd00 = m11*m22 - m21*m12;
          float sd10 = m01*m22 - m21*m02;
          float sd20 = m01*m12 - m11*m02;
          float det = m00*sd00 + m20*sd20 - m10*sd10;
          if (Math.abs(det) == 0f) {
              // determinant is zero; matrix is not invertible
              throw new SingularMatrixException(this.toString());
          }
          float rdet = 1f / det;
          return result.set(+sd00 * rdet,
                            -(m10*m22 - m20*m12) * rdet,
                            +(m10*m21 - m20*m11) * rdet,
  
                            -sd10 * rdet,
                            +(m00*m22 - m20*m02) * rdet,
                            -(m00*m21 - m20*m01) * rdet,
  
                            +sd20 * rdet,
                            -(m00*m12 - m10*m02) * rdet,
                            +(m00*m11 - m10*m01) * rdet);
      }
docs: {@inheritDoc} This code is based on the examples in the
  <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and Quaternion FAQ</a>.