code: public static final BigDecimal sqrt(BigDecimal n) {
  		if (n.compareTo(BigDecimal.ZERO) <= 0) {
  			throw new IllegalArgumentException();
  		}
  
  		final BigDecimal TWO = new BigDecimal("2");
  		BigDecimal error;
  		BigDecimal lastGuess = BigDecimal.ZERO;
  		BigDecimal guess = BigDecimal.ONE.movePointRight(n.toBigInteger().toString().length() / 2);
  		int maxIterations = 50;
  		int iterations = 0;
  		boolean more = true;
  		while (more) {
  			lastGuess = guess;
  			guess = n.divide(guess, UJMPSettings.getInstance().getMathContext());
  			guess = guess.add(lastGuess);
  			guess = guess.divide(TWO, UJMPSettings.getInstance().getMathContext());
  			error = n.subtract(guess.multiply(guess));
  			if (++iterations >= maxIterations) {
  				more = false;
  			} else if (lastGuess.equals(guess)) {
  				more = error.abs().compareTo(BigDecimal.ONE) >= 0;
  			}
  		}
  		return guess;
  	}
docs: adapted from http://www.merriampark.com/bigsqrt.htm