code: public static double getAngle(Matrix rotation) {
  		double c = (rotation.trace()-1)/2.0; //=cos(theta)
  		// c is sometimes slightly out of the [-1,1] range due to numerical instabilities
  		if( -1-1e-8 < c && c < -1 ) c = -1;
  		if( 1+1e-8 > c && c > 1 ) c = 1;
  		if( -1 > c || c > 1 ) {
  			throw new IllegalArgumentException("Input matrix is not a valid rotation matrix.");
  		}
  		return Math.acos(c);
  	}
docs: Calculate the rotation angle for a given matrix
  @param rotation Rotation matrix
  @return The angle, in radians