How to print square root ?

Hi...i want to print square root on command prompt and a symbol(i don't know what it's name for second symbol). But i get a problem. Below is my code. For what i understand i should use \u221A right? :-
public class Test
     public static void main(String[]args)
          try
               System.out.println("\u221A");
               System.out.println("\u00ea");
          catch(Exception e)
               e.printStackTrace();
}But the result is only question mark...can someone show me the right way and what's wrong to my code. I very appreciate to any help. Thank you.

but it does show up in swing components
import javax.swing.*;
import java.awt.*;
public class printsymb
     private static final String SYMBOL = String.valueOf( '\u221A' );
     public static void main( String args[] )
          display( SYMBOL );
          System.out.print( SYMBOL );
          System.out.println( 4 );
     private static void display( String symbol )
          JTextArea text = new JTextArea( symbol );
          JFrame f = new JFrame();
          f.add( text, BorderLayout.CENTER );
          enableJFrame( f );
     private static void enableJFrame( JFrame frame )
          frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
          frame.setSize( 320, 240 );
          frame.setVisible( true );
}you can always put it out like this "sqrt(someExp)" can't you?
Edited by: scphan on Apr 4, 2009 1:41 PM

Similar Messages

  • How to take square root of it

    Hi Folks!
    Can anybody tell me how to take square root of this value "bi"?
    BigInteger bi = BigInteger.valueOf(2000000000);
    Thanks in advance.

    I wrote this simple sqrt function for BigInteger.
    * Returns the largest BigInteger, n, such that bigInt>=n*n.
    * If round is true, the function returns n+1 if it is closer to actual square root.
    * @param round if true, attempt to find a closer value by rounding up.
    * @return <tt>round ? round(sqrt(bigInt)) : floor(sqrt(bigInt))</tt>
    public static BigInteger sqrt(BigInteger bigInt, boolean round){
         BigInteger op = bigInt;
         BigInteger res = BigInteger.ZERO;
         BigInteger tmp;
         int shift = bigInt.bitLength()-1;     
         shift -= shift&1;
         // set one to highest power of 4 <= bigInt
         BigInteger one = BigInteger.ONE.shiftLeft(shift);
         while(one.signum()>0){
              tmp = res.add(one);
              if(op.compareTo(tmp)>=0){
                   op = op.subtract(tmp);
                   res = res.add(one.shiftLeft(1));
              res = res.shiftRight(1);
              one = one.shiftRight(2);
         if(round&&op.signum()!=0){
              op = bigInt.subtract(res.pow(2));
              if(op.compareTo(res)>0){
                   res = res.add(BigInteger.ONE);
         return res;
    }

  • How to find square root, log recursively???

    I need to find the square root of a number entered recursively and log as well. Your help would be greatly appreciated. Thanks in advance!
    import java.io.*;
    /**Class provides recursive versions
    * of simple arithmetic operations.
    public class Ops2
         private static BufferedReader in = null;
         /**successor, return n + 1*/
         public static int suc(int n)
              return n + 1;
         /**predecessor, return n - 1*/
         public static int pre(int n)
              if (n == 0)
                   return 0;
              else
                   return n - 1;
         /**add two numbers entered*/
         public static int add(int n, int m)
              if (m == 0)
                   return n;
              else
                   return suc(add(n, pre(m)));
         /**subtract two numbers entered*/
         public static int sub(int n, int m)
              if (n < m)
                   return 0;
              else if (m == 0)
                   return n;
              else
                   return pre(sub(n, pre(m)));
         /**multiply two numbers entered*/
         public static int mult(int n, int m)
              if (m == 0)
                   return 0;
              else
                   return add(mult(n, pre(m)), n);
         /**divide two numbers entered*/
         public static int div(int n, int m)
              if (n < m)
                   return 0;
              else
                   return suc(div(sub(n, m), m));
         /**raise first number to second number*/
         public static int exp(int n, int m)
              if (m == 0)
                   return 1;
              else
                   return mult(exp(n, pre(m)), n);
         /**log of number entered*/
         public static int log(int n)
              if (n < 2)
                   return 0;
              else
                   return suc(log(div(n, 2)));
         /**square root of number entered*/
         public static int sqrt(int n)
              if (n == 0)
                   return 0;
              else
                   return sqrt(div(n, ));
         /**remainder of first number entered divided by second number*/
         public static int mod(int n, int m)
              if (n < m)
                   return 0;
              else
                   return mod(div(n, pre(m)), m);
         public static void prt(String s)
              System.out.print(s);
         public static void prtln(String s)
              System.out.println(s);
         public static void main(String [ ] args)
              prtln("Welcome to the amazing calculator");
              prtln("It can add, multiply and do powers for");
              prtln("naturals (including 0). Note that all the");
              prtln("HARDWARE does is add 1 or substract 1 to any number!!");
              in = new BufferedReader(new InputStreamReader ( System.in ) );
              int It;
              while ( (It = getOp()) >= 0)
                   prt("" + It + "\n");
            private static int getOp( )
            int first, second;
            String op;
            try
                System.out.println( "Enter operation:" );
                do
                    op = in.readLine( );
                } while( op.length( ) == 0 );
             System.out.println( "Enter first number: " );
                first = Integer.parseInt( in.readLine( ) );
                System.out.println( "Enter second number: " );
                second = Integer.parseInt( in.readLine( ) );
             prtln("");
             prt(first + " " + op + " " + second + " = ");
                switch( op.charAt( 0 ) )
                  case '+':
                    return add(first, second);
                  case '-':
                       return sub(first, second);
                  case '*':
                    return mult(first, second);
                  case '/':
                       return div(first, second);
                  case '^':
                    return exp(first, second);
                  case 'v':
                       return log(first);
                  case 'q':
                       return sqrt(first);
                  case '%':
                       return mod(first, second);
                  case 's':
                       return suc(first);
                  case 'p':
                       return pre(first);
                  default:
                    System.err.println( "Need +, *, or ^" );
                    return -1;
            catch( IOException e )
                System.err.println( e );
                return  0;
    }

    Hi,
    Is there any one to make a program for me in Turbo
    C++ for Dos, which can calculate the square root of
    any number without using the sqrt( ) or any ready
    made functions.
    The program should calculate the s.root of the number
    by a formula or procedure defined by the user
    (programmer).
    Thanks.This is a Java forum!
    If you want Java help:
    1. Start your own thread.
    2. Use code tags (above posting box) if you post code.
    3. No one will write the program for you. We will help by answering your questions and giving advice on how to fix problems in code you wrote.
    4. The formula you need to implement is given above by dizzy.

  • ForLoop Square Root Calculator Program

    * Programmer:      R McBride
    * Date:           November 29, 2006
    * Filename:     SquareRootForLoop.java
    * Purpose:          This program uses for()loops to
    *                    find the square root of a number
    *                    up to four decimal places long.
    import APCS.Keyboard;
    class SquareRootForLoopTest1
         public static void main (String[]args)
              //define variables
              double SquareRoot = 0; //holds initial value
              double num1 = 0;
              boolean done = false;
              double tempReg1 = 0; //holds initial value of i
              double tempReg2 = 0; //holds
              double tempReg3 = 0;
              //while loop start
    //          while (!done)
              //program input
              System.out.println("\t\t\tSQUARE ROOT CALCULATOR PROGRAM");
              System.out.println(""); //skip line
              System.out.println("Enter the number you would like to be square rooted or [0] to end the program.");
              System.out.print("");
              SquareRoot = Keyboard.readInt();
              System.out.println(""); //skip line
              System.out.println("You entered "+SquareRoot+".");
              System.out.println(""); //skip line
              //for loop function
              for(int i = 0; i < 999999; i++)
              tempReg1 = i * i;
              tempReg2 = i;
    //          while (!done)
                        if(tempReg1 == SquareRoot)
                             System.out.println("The square root is "+tempReg2);
                             System.out.println("");
                        else
                             System.out.print("");
              //while loop check to finish
    //          if(SquareRoot == 0)
    //               done = true;
    //          }//end while loop
    }Here is my code for and of you who ever wants to use it. Our assignment was to make a square root calculator using ForLoop (a.k.a. no square root functions).
    My question is, how would I make it increase by .0001 instead of 1 every loop? I need it to do that so I can find square roots of numbers of numbers that have decimals for squares.

    * Programmer:      R McBride
    * Date:           November 29, 2006
    * Filename:     SquareRootForLoop.java
    * Purpose:          This program uses for()loops to
    *                    find the square root of a number
    *                    up to four decimal places long.
    import APCS.Keyboard;
    class SquareRootForLoopTest1
         public static void main (String[]args)
              //define variables
              double SquareRoot = 0; //holds initial value
              double num1 = 0;
              boolean done = false;
              double tempReg1 = 0; //holds initial value of i
              double tempReg2 = 0; //holds
              double tempReg3 = 0;
              //while loop start
    //          while (!done)
              //program input
              System.out.println("\t\t\tSQUARE ROOT CALCULATOR PROGRAM");
              System.out.println(""); //skip line
              System.out.println("Enter the number you would like to be square rooted or [0] to end the program.");
              System.out.print("");
              SquareRoot = Keyboard.readInt();
              System.out.println(""); //skip line
              System.out.println("You entered "+SquareRoot+".");
              System.out.println(""); //skip line
              //for loop function
              for(double i = 0; i < 999999; i+=.0001)
              tempReg1 = i * i;
              tempReg2 = i;
    //          while (!done)
                        if(tempReg1 == SquareRoot)
                             System.out.println("The square root is "+tempReg2);
                             System.out.println("");
                        else
                             System.out.print("");
              //while loop check to finish
    //          if(SquareRoot == 0)
    //               done = true;
    //          }//end while loop
    }Still doesn't work. =[                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Calculating Square root.

    Hi, I'm suppose to write a programme that asks the user to enter a number. Find the square root of that number. Format theoutput to 4 decimal places. Use Math.sqrt(double a). i.e. to find the square root of 9.56, use: double sq = Math.sqrt(9.56);
    This is what I have:
    import java.io.*;
    import java.math.*;
    public class MethodEx2
      static BufferedReader keyboard = new BufferedReader (new
      InputStreamReader(System.in));
      public static void main (String[] args) throws IOException
        double num = 0;
        System.out.print("Please enter a number");
        System.out.flush();
        num = Integer.parseInt(keyboard.readLine());
        calsqrt(num);
      public static double sqrt (double number);
        double result = 0;
        result = sqrt(number);
        System.out.print(result);
    }I keep getting an error saying that it cannot return a value from method whose result type is void at line 33, col 11.
    How do I make the program to work?

    Oh okay, thanks. I also found another typo. I fixed it but it still doesn't work. Anyway, this is my new code:
    import java.io.*;
    import java.math.*;
    public class MethodEx2
      static BufferedReader keyboard = new BufferedReader (new
      InputStreamReader(System.in));
      public static void main (String[] args) throws IOException
        double num = 0;
        System.out.print("Please enter a number");
        System.out.flush();
        num = Integer.parseInt(keyboard.readLine());
        sqrt(num);
      public static double sqrt (double number)
        double result = 0;
        result = sqrt(number);
        System.out.print(result);
    }It says that MethodEx2.java is missing return statement at line 17, column 3. I'm not sure which variable I should return. I tried 'number' and 'result' but something like this happens:
    "C:\Program Files\JBuilder9\jdk1.4\bin\javaw" -classpath "E:\Lili\School\GR12 Comp Sci\Period 1\Programs\MethodExs\Ex2\Ex2\classes;C:\Program Files\JBuilder9\jdk1.4\demo\jfc\Java2D\Java2Demo.jar;C:\Program Files\JBuilder9\jdk1.4\demo\plugin\jfc\Java2D\Java2Demo.jar;C:\Program Files\JBuilder9\jdk1.4\jre\lib\charsets.jar;C:\Program Files\JBuilder9\jdk1.4\jre\lib\ext\dnsns.jar;C:\Program Files\JBuilder9\jdk1.4\jre\lib\ext\ldapsec.jar;C:\Program Files\JBuilder9\jdk1.4\jre\lib\ext\localedata.jar;C:\Program Files\JBuilder9\jdk1.4\jre\lib\ext\sunjce_provider.jar;C:\Program Files\JBuilder9\jdk1.4\jre\lib\im\indicim.jar;C:\Program Files\JBuilder9\jdk1.4\jre\lib\jaws.jar;C:\Program Files\JBuilder9\jdk1.4\jre\lib\jce.jar;C:\Program Files\JBuilder9\jdk1.4\jre\lib\jsse.jar;C:\Program Files\JBuilder9\jdk1.4\jre\lib\rt.jar;C:\Program Files\JBuilder9\jdk1.4\jre\lib\sunrsasign.jar;C:\Program Files\JBuilder9\jdk1.4\lib\dt.jar;C:\Program Files\JBuilder9\jdk1.4\lib\htmlconverter.jar;C:\Program Files\JBuilder9\jdk1.4\lib\tools.jar" MethodEx2
    Please enter a number9
    java.lang.StackOverflowError
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)
         at MethodEx2.sqrt(MethodEx2.java:19)

  • Square root formula

    I have a program that has three columns, in the first column it lists numbers 0-10, in the second column I need to get the square root of each number in the first column. How would I get those results. What is the formula for the square root and how would I code it in? Here is my code so far
    public class ThreeColumn {
        public static void main(String[] args) {
        System.out.println("Number \t Square root \t Even/Odd \t \n");
        int  Ans1 = 0, Ans2 = 0, Ans3 = 0;
         for (int i = 0; i <= 10; i++)
    System.out.println(Ans1 + "\t" );
    Ans1++;
    }Thanks

    Here's something to play around with
    import java.text.*;
    class Testing
      public Testing()
        DecimalFormat df = new DecimalFormat("0.00");
        String[] header = {"Number", "Sqr Root","Even/Odd"};
        String pad = "        ";
        for(int x = 0; x < header.length; x++) System.out.print(header[x]+" ");
        System.out.println("\n========================");
        String sqrNum;
        String[] evenOdd = {"Even","Odd"};
        for(int x = 1; x <= 10; x++)
          sqrNum = df.format(Math.sqrt(x));
          System.out.println((pad+x).substring(pad.length()-header[0].length()+(""+x).length())+
                             (pad+sqrNum).substring(pad.length()-header[1].length()+sqrNum.length()-1)+
                             (pad+evenOdd[x%2]).substring(pad.length()-header[2].length()+evenOdd[x%2].length()-1));
        System.exit(0);
      public static void main(String[] args){new Testing();}   
    }

  • Square root calculation method

    I'm trying to create java code that displays the square root of a number that the user enters, as I am not a great mathematician i cannot work out the logic for this. Any help would be great.
    This is the part of my code that I need assistance with: n1 is the number that the user enters and n2 is where the square root is returned to. I'm guessing that i need to have a loop of some sort to divide n1, but am unsure of the conditions. The n1 is 0 so that after the total is calculated from n1, it is cleared for another number to be entered.
    else if (source == btnSquareRoot)
    n2 = ;
    n1 = 0;
    Please help!

    An adequate method for finding a square root of a number x is this:
    Choose a number that is too low to be the actual square root. (How you do this, I don't know, but zero is pretty small and might be low enough)
    Call that number lo:
    Choose a number that is too high to be the actual square root. (Same comment. well almost. Don't use zero for this - it's too small)
    Call it hi:
    Note, it is easy to check and see that the numbers you have choosen have the required properties. because lo*lo < x and hi*hi > x
    Now you have two candidates for the square root, one of them too low and one of them two high. The actual square root lies somewhere between those two bounds.
    What you want to do now is squeeze those bounds tighter. You do that by choosing a number that is between lo and hi. The mid point would be a nice choice. You may need to figure out how to compute that.
    call that number a:
    well now, either a was itself too low, too high or just right. If it was too low, why replace lo with a and you have just improved the lower bound, if it was too high...
    surely you get the idea.
    Now the question is: How long do you keep this up? Do you ever get the actual square root this way? The answer is: Of course you don't. Most of the time the actual square root requires an infinite number of decimals to represent it. All you are looking for is something that is good enough.
    What does good enough mean? Did you want the number correct to 2 decimal places, to 4 decimals. What do you want? How can you tell if lo and hi are practically the same number?
    If this was a homework problem, that of course goes back to what the teacher wants. If the teacher did not clearly specify, you need to go back and ask what they actually wanted.
    On the other hand if you want to earn a reputations as a smart ass, you figure out some way to detect that the number that you are working on does not have an exact square root and when it does not, you simply print out the message "Sorry - the square root of the number you are looking for cannot be represented in a finite number of digits without resorting to the notation of continued fractions but here it is to 3 decimals..."
    This is the sort of stuff that wins big bonus points with professors.
    On the other hand the way you lose big points with the professors if you say something like that and CAN NOT explain to him what a continued fraction is and explain what you meant by the qualification.
    The other thing that loses big is to cut a chunk of text directly off of a web page and try to fob it off as your own program. Since most professors know how to google, they will stuff some unlikely looking phrase like "notation of continued fractions" and boom they are immediately at this page.
    My point is that if you are going to be a smart ass, you MUST do it carefully or you lose all credibility.
    Sorry for the digression there. Hope this algorithm outline is enough to get you thinking.
    Wow! Killer. I previewed my question and it put asterisks in where I wrote the word, "ass". That is Fucking awesome! They've put in some kind of bad word filter so that when I get fucking abusive with my language and call you a no good shit for brains mother fucker. it cleans it all up for me. That is just too fucking sweet! It sure is a load off of my mind. I guess they just couldn't figure out how to put in !@%#^ which is the way that you actually are supposed to replace vulgarity in the printed word. Oh well, we always knew that this site was maintained by a bunch of **** ***** * **** ***** ** ***** * * *********!

  • Problems with square root approximations with loops program

    i'm having some trouble with this program, this loop stuff is confusing me and i know i'm not doing this correctly at all. the expected values in the tester are not matching up with the output. i have tried many variations of the loop in this code even modifying the i parameter in the loop which i guess is considered bad form. nothing seems to work...
    here is what i have for my solution class:
    /** A class that takes the inputted number by the tester and squares it, and
    *  loops guesses when the nextGuess() method is called. The epsilon value is
    *  also inputted by the user, and when the most recent guess returns a value
    *  <= epsilon, then the hasMoreGuesses() method should return false.
    public class RootApproximator
       /** Takes the inputted values from the tester to construct a RootApproximator.
        * @param val the value of the number to be squared and guessed.
        * @param eps the gap in which the approximation is considered acceptable.
         public RootApproximator(double val, double eps)
              value = val;
              square = Math.sqrt(val);
              epsilon = eps;
       /** Uses the algorithm where 1 is the first initial guess of the
        *  square root of the inputted value. The algorithm is defined by
        *  "If X is a guess for a square root of a number, then the average
        *  of X and value/X is a closer approximation.
        *  @return increasingly closer guesses as the method is continually used.
       public double nextGuess()
             final int TRIES = 10000;
             double guess = 1;
              for (double i = 1; i < TRIES; i++)
                   double temp = value / guess;
                   guess = (guess + temp) / 2.0;
              return guess;
       /** Determines if there are more guesses left if the difference
        *  of the square and current guess are not equal to or less than
        *  epsilon.
        *  @return the value of the condition.
       public boolean hasMoreGuesses()
              return (square - guess <= epsilon);
       private double square;
       private double value;
       private double epsilon;
       private double guess;
    here is the tester:
    public class RootApproximatorTester
       public static void main(String[] args)
          double a = 100;
          double epsilon = 1;
          RootApproximator approx = new RootApproximator(a, epsilon);
          System.out.println(approx.nextGuess());
          System.out.println("Expected: 1");
          System.out.println(approx.nextGuess());
          System.out.println("Expected: 50.5");
          while (approx.hasMoreGuesses())
             approx.nextGuess();
          System.out.println(Math.abs(approx.nextGuess() - 10) < epsilon);
          System.out.println("Expected: true");
    and here is the output:
    10.0
    Expected: 1 // not sure why this should be 1, perhaps because it is the first guess.
    10.0
    Expected: 50.5 // (100 + 1) / 2, average of the inputted value and the first guess.
    true
    Expected: true
    i'm new to java this is my first java course and this stuff is frustrating. i'm really clueless as to what to do next, if anyone could please give me some helpful advice i would really appreciate it. thank you all.

    i'm new to java this is my first java course and this
    stuff is frustrating. i'm really clueless as to what
    to do nextMaybe it's because you don't have a strategy for what the program is supposed to do? To me it looks like a numerical scheme for finding the squareroot of a number.
    Say the number you want to squarerroot is called value and that you have an approximation called guess. How do you determine whether guess is good enought?
    Well in hasMoreGuesses you check whether,
    (abs(value-guess*guess) < epsilon)
    The above decides if guess is within epsilon of being the squareroot of value.
    When you calculate the next guess in nextGuess why do you loop so many times? Aren't you supposed to make just one new guess like,
    guess = (guess + value/guess)/2.0
    The above generates a new guess based on the fact that guess and value/guess must be on each side of value so that the average of them must be closer too value.
    Now you can put the two together to a complete algoritm like,
    while (hasMoreGuesses()) {
       nextGuess();
    }In each iteration of the loop a new "guess" of the squareroot is generated and this continues until the guess is a sufficiently close approximation of the squareroot.

  • Sampling procedure-Square root n+1

    Hi All,
    I need to calculate the sample size based on the Containers & Square  root n+1.
    How to configure the system & how to maintain the master data to get the sample size.
    User also insisted only the sample size has to be calculated, but he will enter only one composite result entry
    Regards
    Subbu

    Hi Subbu,
    you can use Physical Sample to control the sample Size.
    You must to define a Sample Drawing Procedure (QPV2) as relevant for Container Number, then assign the formula 'Square Root n1´ ( TRUNC(SQRT(P2)1) ) in the partial sample. In this scenario, I suggest you to configure the "Container number' as a mandatory field during the goods receipt once the system will need this information to calculate the sample. For a single result recording, you can define a pooled sample.
    I hope it can help you.
    Best regards,
    Robson

  • Java Help....square root problems...

    im just about done with this program except i have to get the square root of the last method i get and when i put in the side 4 and 2 i get 20 as the answer but i need to find the square root of it...my teacher mentioned the math method and i only have this so far and have no idea wat to do with it java.lang.Math.sqrt();
    //this is my test class with system out puts
         System.out.print("Enter the first smaller side: ");
         s1= console.readDouble();
         System.out.print("Enter the second smaller side: ");
         s2= console.readDouble();
         System.out.println("Hypotenuse= " + haveFun.getHyp(s1, s2));
    //my main class Fun with the method to get hypotenuse
         * get hypotenuse of a right triangle
    public double getHyp(double s1, double s2)
              // put your code here
              return (s1 * s1) + (s2 * s2);
         }

    and have no idea wat to do with it
    java.lang.Math.sqrt();
    Then it's time to read the manual:
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Math.html#sqrt(double)

  • Calculator square root event listener

    I am trying to write a calculator using JButtons added onto Jpanels. Getting numbers to add , divide, multilpy etc. is simple enough, but i need to write an event handler for a button which calculates the square root of a given number. This is easy enough if you want the square root of 4,9,16,25 etc but if you enter a number which produces a decimal point value it doesn't work.
    I am trying to do this using a variable "number" which is of type double, but have tried using it as a float, but it still doesn't work! here is my code for handling a click on the Square root JButton.
         if(e.getActionCommand().equals("Sqrt")){
         number = new Double(jtf.getText().trim()).doubleValue();
         double rootNum = 1.000;
         while(rootNum*rootNum <= number){
              double rootTester = rootNum * rootNum;
              if(rootTester == number){
                   jtf.setText(String.valueOf(rootNum));
    rootNum = rootNum+1;

    How about
    double answer = Math.sqrt(number);

  • Calculate square root including sum and product

    Hi,
    I have to enter the square root of:
    Text1*Text1+Text2*Text2-2*Text1*Text2*Text3
    How do i do that?
    I hope someone can help me.

    Thanks a million try67,
    i found another way that worked as well:
    event.value = Math.sqrt(+this.getField("Text1").value*this.getField("Text1").value+this.getField("Text2 ").value*this.getField("Text2").value-2*this.getField("Text1").value*this.getField("Text2" ).value*this.getField("Text3").value)
    Mine is much more confuse:)

  • The square root free Cholesky factorization

    The Attached code calculates the square root free Cholesky factorization (LDL'), it is very useful to decompose matrices and in my specific case, to make observability analysis within electrical distribution networks. I'm publishing it because LV counts with other kind of decompositions like the LU decomposition, very useful but for my case, the values delivered by LDL' are more accurate and easier to calculate.
    Best regards
    Davis
    Davis Montenegro
    Attachments:
    LDLT.zip ‏33 KB

    Davis,
    How easy do you think it would be to port this over to the FPGA environment?  Just a quick inspection shows the NaN check and I am not sure how this plays into the porting of the code. 
    This is exactly what I have been working on today and would have saved myself some time if I had known someone smarter than myself had already pieced this out.   Thanks a lot!
    Matt
    Matt Richardson
    Certified LabVIEW Developer
    MSR Consulting, LLC

  • Fastest square root algorithm

    I was looking for a fast algorythm for integer square roots and I found this one http://medialab.freaknet.org/martin/src/sqrt/.
    The algorithm comes from a book by Mr C. Woo on how to do maths on an abacus.
    I post the javaized version here in case anyone finds it interesting.
    I believe this is the fastest square root function in existance for integers (and in game programming much of the time you aren't interested in fractions)
    /* Fast interger square root adapted from algorithm by Martin Guy @ UKC, June 1985.
        *   Origonally from a book on programming abaci by Mr C. Woo.
       public static int fastSqrt2(int n)
          int op, res, one;
          op = n;
          res = 0;
          /* "one" starts at the highest power of four <= than the argument. */
          one = 1 << 30;   /* second-to-top bit set */
          while (one > op) one >>= 2;
          while (one != 0)
             if (op >= res + one)
                op = op - (res + one);
                res = res +  (one<<1);
             res >>= 1;
             one >>= 2;
          return(res);
       }

    public static double sqrt(double a){
      if(a<0) throw new IllegalArgumentException("number<0");
      double precision=0.001;
      double x_nMinus1 = -1;
      double x_n = 1;
      while( Math.abs(x_n - x_nMinus1) > precision ) {
        x_nMinus1 = x_n;
        x_n = (x_nMinus1 * x_nMinus1 + a) / (2*x_nMinus1);          
      return x_n;           
    }

  • Square Root Help

    ok, I used the search function and had a hard time understanding how to do things and I don't think any of the posts answered my question.
    Right now, I am working on an assignment that makes me figure out the quadratic formula. I am having trouble with the square root part of the program.
    For instance that part is: sqrt( b*b - 4*a*c)
    I want my program to be able to tell if the square root is a perfect square then go ahead an calculate it, but if it is not, then we just want to reduce the square root function, or even if it is a perfect square, I need to make the program reduce fractions when possible.
    For instance, here is an example that is a perfect square: sqrt(25) = 5 , the program would just spit out five automatically.
    BUT
    If it were: sqrt(24), then I would want it to reduce it to 2 sqrt(6) and that is what the program would pop out.
    Also, I am having trouble on how to tell the program how to "reduce fractions" , because if I had the square root in the last example, I might be able to reduce fractions for the whole quadratic function.
    example. ( 2 - 2 sqrt(6) ) / 2              would reduce to   1 - sqrt(6) and that is what the program would say.
    basically it seems like we are avoiding actually dealing with decimals.
    If you could just point me in the right direction or have a good link, it would be appreciated!!!

    It seems to me your real problem is taking a number and finding all prime factors of that number. Once you have a list of those, you know you can pull duplicates out of the square root. If all of them were duplicates, you had a perfect square.
    Here's a simple program I scrawled out to factor and reassemble into the appropriate form:
    import java.util.*;
    class FactorTest {
        public static void main(String[] args) {
            int value = 96;
            LinkedList<Integer> factors = new LinkedList<Integer>();
            LinkedList<Integer> primeNumbers = new LinkedList<Integer>();
            populatePrimeList(primeNumbers);
            while (value > 1) {
               boolean factorFound = false;
               for (int prime : primeNumbers) {
                  if (value % prime == 0) {
                     value = value / prime;
                     factors.add(prime);
                     factorFound = true;
                     break;
               if (!factorFound) {
                  expandPrimeList(primeNumbers);
            int left = 1;
            int right = 1;
            int lastValue = 1;
            for (int factor : factors) {
               if (lastValue == factor) {
                  left *= factor;
                  lastValue = 1;
               else {
                  right *= lastValue;
                  lastValue = factor;
            right *= lastValue;
            System.out.println(left + " sqrt " + right);
        public static void populatePrimeList(LinkedList<Integer> primes) {
           primes.add(2);
           primes.add(3);
           primes.add(5);
           primes.add(7);
           primes.add(11);
           primes.add(13);
        public static void expandPrimeList(LinkedList<Integer> primes) {
           int testPrime = primes.get(primes.size() - 1);
           boolean foundFactors;
           do {
              foundFactors = false;
              testPrime += 2;
              for (int prime : primes) {
                 if (testPrime % prime == 0) {
                    foundFactors = true;
                    break;
           } while (foundFactors);
           primes.add(testPrime);
    }Edited by: jboeing on Jan 15, 2008 11:18 AM

Maybe you are looking for

  • The back up is on my work computer. Can I set it up as a new iphone and then later upload the info from itunes

    Hi, My phone got stolen and I just got my replacement iphone 4 today. I don't have the itunes back up on my computer, but I do have it backed up at work. I want to start using th phone- can i set it up as a new phone and then update it in a few days

  • FIND with MATCH OFFSET not working

    Hi, I have a statement: FIND '/' IN <ls_data_package>-/bic/zbib_sysn MATCH OFFSET off2. this works in all the case except for when <ls_data_package>-/bic/zbib_sysn = SSULTANA-VMC/. (i.e. when /bic/zbib_sysn = USERID-VMC/, here SSULTANA is the user ID

  • Inconsistent results with MDX formula

    Hi. I'm converting a BSO cube to ASO, and it has dynamically calculated formulas that I'm converting to MDX. I have a formula that is supposed to accumulate an account (Order Intake) through the months and years until it gets to the current month of

  • Calling an ABAP Program from source system in a process chain

    Hi, I need to call an ABAP program (Extract program RMBWV308) from R/3 within a Process Chain in BW 3.5 Your urgent advice please

  • Open form in separate window

    Hi gentlemen I have parent form include button this button when the user press it, it will call the other form but in same window (that what I don't want) My question is how I can open another form in separate window (same as when you open it alone)