Adding binary numbers in java please help!!

Hello all, im a total newbie to java and i need your help urgently, i have two variables
that are integers, that store binary numbers i.e.
int tmpIntOne, tmpIntTwo;
tmpIntOne = 1010;
tmpIntTwo = 1110;
i want to add these numbers together and return a binary result so far when you add them together you get:
2120
however i would like a binary result so that
result = tmpIntOne + tmpIntTwo;
= 11000
Thank you.

Hello all, im a total newbie to java and i need your
help urgently, i have two variables
that are integers, that store binary numbers i.e.
int tmpIntOne, tmpIntTwo;
tmpIntOne = 1010;
tmpIntTwo = 1110;These are not binary numbers. These are decimal numbers whose digits consist of ones and zeros. If you want to interpret the characters "010" as a binary number, then do
int tmp1 = Integer.parseInt("1010", 2);
etc.
i want to add these numbers together
int result = tmp1 + tmp;
and return a
binary result Adding two ints will give an int. Int's are always binary. If you want to display it as a binary String, as opposed to the usual decimal String, then, as suggested, use toBinaryString.

Similar Messages

  • Pascal to Java Please help me!

    I am truobled in creating a validation method for the user loging in....
    As I am perfect at Pascal can anyone translate the following pascla code to Java Please help me with this.
    PROGRAM USERLOGIN;
    TYPE
      USER_TYPE = RECORD
        USERNAME : STRING[15];
        PASSWORD : STRING[15];
    END;
        USFILE = FILE OF USER_TYPE;
    VAR
       USER: USER_TYPE;
       CKUSER: USER_TYPE;
       RECFILE : USFILE;
       I,J     : INTEGER;
    BEGIN
    WRITE('ENTER USERNAME:');READLN(CKUSER.USERNAME);
    WRITE('ENTER PASSWORD:');READLN(CKUSER.PASSWORD);
    FILESPEC :='USERFILE.USR';
    ASSIGN(RECFILE, FILESPEC);
    RESET(RECFILE);
      WHILE NOT EOF(RECFILE) DO
       BEGIN
         READ(RECFILE, USER);
         IF CKUSER.USERNAME = USER.USERNAME AND CKUSER.PASSWORD = USER.PASSWORD THEN
              LOGIN
        ELSE
              WRITE('USER NOT FOUND');
       END;
    END.Thank you

    Don't bother:
    http://forum.java.sun.com/thread.jsp?forum=54&thread=539277

  • Why the same name of process comes out in AIX , in java. please help me.

    Hello.
    I have two questions related to Jvm.
    I've developed Job scheduler program which is doing somthing as the DB schedule is set in the way of Multi
    thread. Currently , I'm in the process of testing this one. It is good , if in the normal case. However, When
    doing Shell, if the application have so a lot to do the Shell, it has a little problem.
    My developing environment is
    OS : AIX 5.3
    JRE : IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 AIX ppc-32 jvmap3260sr7-20091214_49398
    (JIT enabled, AOT enabled)
    nofiles(descriptors) 2000
    maxuproc 4096 Maximum number of PROCESSES allowed
    per user True
    In order to execute Shell in My Scheduler program , I tested Runtimeexec() or ProcessBuilder.
    The result of mine in the test , when the executed Shell got over 300 is
         1. The jvm processes that I execute at the first time are shown up , after Shell go to the finish, the
    processes are all in the disappearance again , and at last The processes that I executed at the first time are
    remaining. It's like the process is duplicated process in the maximum of 70.
    When I do shell about 200 to be executed simultaneously, Duplicated jvm about 3 appeared momentarily, then
    disappeared, and also under 120, No duplicated case is found when under 120.
    ps -ef result is below , when shell is excuted
    UID PID PPID C STIME TTY TIME CMD
    jslee 626906 1 0 11, May - 2:20 java -
    DD2_JC_HOME=/source/jslee/JOB -Dfile.encoding=euc-kr jobserver.JobServerMain
    jslee 1421522 626906 0
    19:36:16 - 0:00 java -DD2_JC_HOME=/source/jslee/JOB -Dfile.encoding=euc-kr jobserver.JobServerMain
    ....Skip.....
    jslee 4374620 626906 0 19:34:06 - 0:00 java -DD2_JC_HOME=/source/jslee/JOB -
    Dfile.encoding=euc-kr jobserver.JobServerMain
    (the process list about 60)
    *the first question : Why a lot of duplicated jvm are shown up when in alot of shell to be executed ?
    *the second question : As you can see above , How can I solve out the problem.
    *Is there some option that I can set up when starting Jvm?
    ---Next question---
    My developing environment is
    OS : SunOS 5.8
    JRE : Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
    Java HotSpot(TM) Server
    VM (build 16.0-b13, mixed mode)
    nofiles(descriptors) 256
    As shown obove , the value of descriptors is 256 .
         My scheduler program executed 300 shell at the same time, in result my program was abnormalily
    terminated after doing shell about 180.
    the Exception info is
    java.io.IOException: Cannot run program "sh": error=24, exceeding the number of opened files
         at
    java.lang.ProcessBuilder.start(Unknown Source)
         at java.lang.Runtime.exec(Unknown Source)
         at
    java.lang.Runtime.exec(Unknown Source)
         at java.lang.Runtime.exec(Unknown Source)
    or
    java.net.SocketException: exceeding the number of opened files     at java.net.PlainSocketImpl.socketAccept
    (Native Method)
    또는
    java.io.IOException: exceeding the number of opened files     at
    java.io.UnixFileSystem.createFileExclusively(Native Method)
         at java.io.File.checkAndCreate(Unknown
    Source)
         at java.io.File.createTempFile(Unknown Source)
    *question : If I continuously request to open a file that go over system limit, is it possible for JVM to be
    terminated?
    *question : Is there a method that obtains state of System limit in the java library.
    *question : what is the best solution to cope with ?
    Please help me
    =

    struts-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
    <struts-config>
      <form-beans>
           <form-bean name="registrationForm" type="ndlinh.struts.lab.RegistrationForm" />
      </form-beans>
      <action-mappings>
           <action path="/register"
                   type="ndlinh.struts.lab.RegistrationAction" // action class
                   name="registrationForm" // form bean name
                   validate="false"
                   scope="request"
                   input="registration.jsp" >
                <forward name="success" path="/jsp/success.jsp"  />
                <forward name="failure" path="/jsp/failure.jsp"  />
           </action>
      </action-mappings>
    </struts-config>HTH

  • I have an ipod 2g , The keyboard won't work! Or at least some of it's letters and numbers won't. please help i'm stuck with emojis

    i have an ippd touch 2g , a part of my keyboard won't work , i can type letters but i can't type numbers . please help i'm stuck with emojis keyboard

    Try restarting the iPod by holding down the lock and home button together and then slide the power button to turn it off and then wait 10 seconds and start it up again. If it is not a reset issue then it may be a hardware issue. Is your iPod damaged or have you dropped it recently? If it is a hardware problem then you may not be able to fix it. If your iPod has multitasking options like the new iOS devices, close out the app and then try again, it should reset your device to letters instead of emojis.

  • Very new to java please help

    i'm very new to java and i'm getting an error in my application. i took 4 applications that compiled and worked separatly and i tried to combine them into one application. i'm getting the error: unreported exception java.io.IOException; must be caught or declared to be thrown, in lines 73,78,83,88,120,146,149,152,155 in the and it points at the keyboard.readLine() but everything i've tried just gives me more errors. please help anything and everything will be greatly appreciated. here it is, sorry about format i dunno how to straighten it in here:
    // ^ ^
    //               (0)(0) A Happy Piggy Application
    // Problems: 2.6,2.8,2.9,2.12 (oo)
    // An application finds the total number of hours, minutes, & seconds, finds the distance
    // between two points, finds the volume and surface area of a sphere, and adds up the change
    // in a jar. First, the total hours, minutes, and seconds problem.
    import java.io.*;
    import java.text.DecimalFormat;
    import java.text.NumberFormat;
    public class twoptsix
         static BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
         static PrintWriter screen = new PrintWriter(System.out, true);
         public static void main (String[] args) throws IOException
              double hoursa, minutesa, secondsa;
              String hours;
              System.out.print ("Please enter a number of hours: ");
    hours = keyboard.readLine();
    hoursa = Double.parseDouble(hours); //asks programmer friendly user to enter hours
    String minutes;
    System.out.print ("Please enter a number of minutes: ");
    minutes=keyboard.readLine();
    minutesa = Double.parseDouble(minutes); //asks programmer friendly user to enter minutes
    String seconds;
    System.out.print ("Pretty please enter a number of seconds: ");
    seconds = keyboard.readLine();
    secondsa = Double.parseDouble(seconds); //asks programmer friendly user to enter seconds
    double allseconds;
    allseconds = (hoursa * 3600) + (minutesa * 60) + secondsa; //adds up all the seconds of the time entered
    System.out.println ("You have: " + hours + " hours..."); //displays hours
    System.out.println ("" + minutes + " minutes..."); //displays minutes
    System.out.println ("and " + seconds + " seconds..."); //displays seconds
              System.out.println ("to get whatever you need to done!"); //witty attempt at humor
    System.out.println ("The total amount of seconds is: " + allseconds + " seconds."); //displays total seconds
    // An application that finds the distance between two points when the points
    // are given by the user.
              double x1, x2, y1, y2, total, distance;
              String xa;
              System.out.print ("Please enter the 'x' coordinate of first point: ");
              xa = keyboard.readLine();
              x1 = Double.parseDouble(xa); //asks programmer friendly user to enter first x value
              String ya;
              System.out.print ("...also need the 'y' coordinate of first point: ");
              ya = keyboard.readLine();
              y1= Double.parseDouble(ya); //asks programmer friendly user to enter first y value
              String xb;
              System.out.print ("...and the 'x' coordinate of the second point: ");
              xb = keyboard.readLine();
              x2 = Double.parseDouble(xb); //asks programmer friendly user to enter second x value
              String yb;
              System.out.print ("...don't forget the 'y' coordinate of the second point: ");
              yb = keyboard.readLine();
              y2 = Double.parseDouble(yb); //asks programmer friendly user to enter second y value
              total = Math.pow(x2 - x1, 2.0) + Math.pow(y2 - y1, 2.0); //squares the differences of values
              distance = Math.sqrt(total); //finds the square root of the sum of the differences of the values
              System.out.print ("E=mc^2...oh and,");
              System.out.print ("the distance between point (" + xa +"," + ya +") and point("+
              xb + "," + yb + ") is : " + distance);
    // An application that takes the radius of a sphere and finds and prints
    // the spheres volume and surface area.
              double radius,volume,area;
              String rad;
              System.out.print("Please enter the radius of a sphere: ");
              rad = keyboard.readLine();
              radius = Double.parseDouble(rad); //asks programmer friendly user to enter the radius of a sphere
    DecimalFormat fmt = new DecimalFormat ("0.####");
              volume = ((4 * Math.PI * Math.pow(radius,3.0)) / 3) ;
              System.out.println (" The sphere has a volume of:" + fmt.format(volume)); //finds and displays volume
              area = ( 4 * Math.PI * Math.pow(radius, 2.0)) ;
              System.out.print (" The Surface Area of the sphere is: " + fmt.format(area)); //finds and displays surface area
    // An application that finds the total, in dollars and cents, of a number of quarters,
    // nickels, dimes, and pennies in your piggy bank.
              int pennies, nickels, dimes, quarters;
              double money1;
              screen.println("Empty your piggy bank and count the change, how many quarters ya have?: ");
              int q = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of quarters
              screen.println("How many dimes?: ");
              int d = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of dimes
              screen.println("How many nickels?: ");
              int n = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of nickels
              screen.println("How many pennies?: ");
              int p = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of pennies
              NumberFormat money = NumberFormat.getCurrencyInstance();
              money1 = (.25 * q) + (.1 * d) + (.05 * n) + (.01 * p);
              screen.println("You're rich! Total, you've got: " + money.format(money1));//finds and displays total money

    Ok here is the working code as one long function:
    // ^ ^
    // (0)(0) A Happy Piggy Application
    // Problems: 2.6,2.8,2.9,2.12 (oo)
    // An application finds the total number of hours, minutes, & seconds, finds the distance
    // between two points, finds the volume and surface area of a sphere, and adds up the change
    // in a jar. First, the total hours, minutes, and seconds problem.
    import java.io.*;
    import java.text.DecimalFormat;
    import java.text.NumberFormat;
    public class twoptsix
        static BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
        static PrintWriter screen = new PrintWriter(System.out, true);
        public static void main (String[] args) throws IOException
    double hoursa, minutesa, secondsa;
    String hours;
    System.out.print ("Please enter a number of hours: ");
    hours = keyboard.readLine();
    hoursa = Double.parseDouble(hours); //asks programmer friendly user to enter hours
    String minutes;
    System.out.print ("Please enter a number of minutes: ");
    minutes=keyboard.readLine();
    minutesa = Double.parseDouble(minutes); //asks programmer friendly user to enter minutes
    String seconds;
    System.out.print ("Pretty please enter a number of seconds: ");
    seconds = keyboard.readLine();
    secondsa = Double.parseDouble(seconds); //asks programmer friendly user to enter seconds
    double allseconds;
    allseconds = (hoursa * 3600) + (minutesa * 60) + secondsa; //adds up all the seconds of the time entered
    System.out.println ("You have: " + hours + " hours..."); //displays hours
    System.out.println ("" + minutes + " minutes..."); //displays minutes
    System.out.println ("and " + seconds + " seconds..."); //displays seconds
    System.out.println ("to get whatever you need to done!"); //witty attempt at humor
    System.out.println ("The total amount of seconds is: " + allseconds + " seconds."); //displays total seconds
    // }  <----- MAIN FUNCTION USED TO END HERE!!!
    //but we want to keep going so remove the bracket!
    // An application that finds the distance between two points when the points
    // are given by the user.
    // {  <-- other function used to start here, but now it continues
    double x1, x2, y1, y2, total, distance;
    String xa;
    System.out.print ("Please enter the 'x' coordinate of first point: ");
    xa = keyboard.readLine();
    x1 = Double.parseDouble(xa); //asks programmer friendly user to enter first x value
    String ya;
    System.out.print ("...also need the 'y' coordinate of first point: ");
    ya = keyboard.readLine();
    y1= Double.parseDouble(ya); //asks programmer friendly user to enter first y value
    String xb;
    System.out.print ("...and the 'x' coordinate of the second point: ");
    xb = keyboard.readLine();
    x2 = Double.parseDouble(xb); //asks programmer friendly user to enter second x value
    String yb;
    System.out.print ("...don't forget the 'y' coordinate of the second point: ");
    yb = keyboard.readLine();
    y2 = Double.parseDouble(yb); //asks programmer friendly user to enter second y value
    total = Math.pow(x2 - x1, 2.0) + Math.pow(y2 - y1, 2.0); //squares the differences of values
    distance = Math.sqrt(total); //finds the square root of the sum of the differences of the values
    System.out.print ("E=mc^2...oh and,");
    System.out.print ("the distance between point (" + xa +"," + ya +") and point("+
         xb + "," + yb + ") is : " + distance);
    //second function used to end here...
    //} <--- COMMENT OUT BRACKET SO WE CONTINUE
    // An application that takes the radius of a sphere and finds and prints
    // the spheres volume and surface area.
    //{ <--- ANOTHER ONE TO COMMENT OUT
    double radius,volume,area;
    String rad;
    System.out.print("Please enter the radius of a sphere: ");
    rad = keyboard.readLine();
    radius = Double.parseDouble(rad); //asks programmer friendly user to enter the radius of a sphere
    DecimalFormat fmt = new DecimalFormat ("0.####");
    volume = ((4 * Math.PI * Math.pow(radius,3.0)) / 3) ;
    System.out.println (" The sphere has a volume of:" + fmt.format(volume)); //finds and displays volume
    area = ( 4 * Math.PI * Math.pow(radius, 2.0)) ;
    System.out.print (" The Surface Area of the sphere is: " + fmt.format(area)); //finds and displays surface area
    // } <----- COMMENTED OUT FOR THE SAME REASON
    // An application that finds the total, in dollars and cents, of a number of quarters,
    // nickels, dimes, and pennies in your piggy bank.
    //{ <----AND ANOTHER
    int pennies, nickels, dimes, quarters;
    double money1;
    screen.println("Empty your piggy bank and count the change, how many quarters ya have?: ");
    int q = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of quarters
    screen.println("How many dimes?: ");
    int d = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of dimes
    screen.println("How many nickels?: ");
    int n = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of nickels
    screen.println("How many pennies?: ");
    int p = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of pennies
    NumberFormat money = NumberFormat.getCurrencyInstance();
    money1 = (.25 * q) + (.1 * d) + (.05 * n) + (.01 * p);
    screen.println("You're rich! Total, you've got: " + money.format(money1));//finds and displays total money
    }P.S. To make the code formatted better put [ code ] before and [ /code ] after. It's not perfect, but a little better...

  • M new to this forum + new to java please help me with file handling program

    hi i want to make a file handling program where in i want to input a text file say f1 whose style is mentioned as below
    aaa...bcd
    aaabbc
    acdce
    a..dd
    abbcd
    now i want to write d out put of file f1 to file f2 but only those string entries widout any ... in them how to do that :-(( please help :((

    import java.io.*;
    import java.lang.*;
    class javcsse{
             void javsce (){
              BufferedReader in;
            PrintWriter out;
            String line;
            try
                in = new BufferedReader(new FileReader("e:\\cntcs\\n7.txt"));
                out = new PrintWriter("e:\\cntcs\\n8.txt");
               line = in.readLine();
               while(line != null)
                     if(line.contains("...") && line.contains("....")){
                         break ;                
                         else{
                               if(line.contains("cc"))
                              System.out.println(line+"\n");
                                      out.println(line);
                    line = in.readLine();
                in.close();
                out.close();
            } catch (Exception ex)
                System.err.println(ex.getMessage());
      public class javcse{
        public static void main(String[] args) {
            new javcsse();
    }hey i wrote this code yet could u tell y is it still not working :((

  • I am new to java please help!!

    please help ive got a method thta i wanto to use it in another class, but it does not work.
    //prueba.java
    import java.io.*;
    public class prueba
    public int numero3;
    public int suma(int numero1,int numero2)
    int numero3=numero1+numero2;
    return numero3;
    //prueba1.java
    import javax.servlet.*;
    import java.io.*;
    import javax.servlet.http.*;
    import prueba;
    public class prueba1 extends HttpServlet
    public void doGet(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    PrintWriter out = res.getWriter();
    int num1=1;
    int num2=1;
    prueba uno=new prueba();
    out.println(uno.suma(2,3));
    when i ty to complie this file it throws me thie errors:
    C:\resin-2.0.b2\doc\content-manager\admin\web-inf\classes\prueba1.java:4: cannot resolve symbol
    symbol: class prueba
    import prueba;
    ^
    C:\resin-2.0.b2\doc\content-manager\admin\web-inf\classes\prueba1.java:15: cannot resolve symbol
    symbol : class prueba
    location: class prueba1
    prueba uno=new prueba();
    ^
    C:\resin-2.0.b2\doc\content-manager\admin\web-inf\classes\prueba1.java:15: cannot resolve symbol
    symbol : class prueba
    location: class prueba1
    prueba uno=new prueba();
    ^
    3 errors
    Tool completed with exit code 1
    both , prueba1.java and prueba.java are in the same folder.

    C:\resin-2.0.b2\doc\content-manager\admin\web-inf\classes\prueba1.java:15: cannot resolve symbol
    symbol : class prueba
    location: class prueba1
         prueba uno=new prueba();
    ^
    C:\resin-2.0.b2\doc\content-manager\admin\web-inf\classes\prueba1.java:15: cannot resolve symbol
    symbol : class prueba
    location: class prueba1
         prueba uno=new prueba();
    ^
    2 errors

  • Recursion in java. please help

    I am writing a program for tree traversing as follows. The program is relatively long but please just focus on 2 lines with errors indicated.
    import java.io.*;
    import myBinaryTree;
    class myBinaryTreeTest{
         static int vertexArray[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 3, 3, 7, 9, 11, 5, 11};     
         static myBinaryTree treeArray[] = new myBinaryTree[10];
         static myBinaryTree tree;
         static pTwoChildNode nodeParent, nodeLeft, nodeRight;
         static treeNodeData dataParent, dataLeft, dataRight;
         public static void main(String[] args) {
         for (int j=0; j<10; j++) {
         treeArray[j]=new myBinaryTree();
    boolean treeArrayEmpty;
    int treeArrayEmptyIndex;
    int treeArrayChildIndex, treeArrayParentIndex;
              int vertexCollapseChild, vertexCollapseParent;
              for (int i=0; i<20; i=i+2) {
    vertexCollapseChild=vertexArray;
    vertexCollapseParent=vertexArray[i+1];
    treeArrayEmptyIndex=-1;
    treeArrayChildIndex=-1;
              treeArrayParentIndex=-1;          
              for (int j=0; j<10; j++) {
                   if (treeArray[j].isEmpty()) {
    if (treeArrayEmptyIndex == -1) {
    treeArrayEmptyIndex=j;
    else {
    dataParent = (treeNodeData)treeArray[j].getData();
                   if (vertexCollapseChild==dataParent.vertex)
    {treeArrayChildIndex=j;};
    if (vertexCollapseParent==dataParent.vertex)
    {treeArrayParentIndex=j;};
    if (treeArrayChildIndex != -1 && treeArrayParentIndex != -1)
                        {break;}
    updateTreeArray(treeArrayChildIndex, treeArrayParentIndex,
                        treeArrayEmptyIndex, vertexCollapseChild,
    vertexCollapseParent);
              for (int j=0; j<10; j++) {                                               
                   System.out.println("\nIn-order:");
                   preOTrav(treeArray[j].getRoot());
         static void updateTreeArray(int c, int p, int e, int cc, int cp) {
                                  // c=treeArrayChildIndex
                                  // p=treeArrayParentIndex
                                  // e=treeArrayEmptyIndex
                                  // cc=vertexCollapseChild
                                  // cp=vertexCollapseParent
    System.out.println(c+" "+p+" "+e+" "+cc+" "+cp);
         if (c != -1) {
    if (p != -1) {
         dataParent = new treeNodeData();
              dataRight = (treeNodeData)treeArray[p].getData();
    dataParent.vertex=dataRight.vertex;
              nodeParent=new pTwoChildNode(dataParent);
    nodeParent.setLeft(treeArray[c].getRoot());
    nodeParent.setRight(treeArray[p].getRoot());
    treeArray[Math.min(c, p)].setRoot(nodeParent);
    treeArray[Math.max(c, p)].setRoot(null);
         else
              dataParent = new treeNodeData();
    dataParent.vertex=cp;
              nodeParent=new pTwoChildNode(dataParent);
    nodeParent.setLeft(treeArray[c].getRoot());
              dataRight = new treeNodeData();
    dataRight.vertex=cp;
              nodeParent.setRight(new pTwoChildNode(dataRight));
    treeArray[Math.min(c, e)].setRoot(nodeParent);
              treeArray[Math.max(c, e)].setRoot(null);
    else
    if (p != -1) {
    dataParent = new treeNodeData();
    dataRight = (treeNodeData)treeArray[p].getData();
    dataParent.vertex=dataRight.vertex;
              nodeParent=new pTwoChildNode(dataParent);
    dataLeft = new treeNodeData();
    dataLeft.vertex=cc;
    nodeParent.setLeft(new pTwoChildNode(dataLeft));
    nodeParent.setRight(treeArray[p].getRoot());
    treeArray[Math.min(p, e)].setRoot(nodeParent);
              treeArray[Math.max(p, e)].setRoot(null);
              else {
    dataParent=new treeNodeData();
    dataParent.vertex=cp;
              nodeParent=new pTwoChildNode(dataParent);
    dataRight=new treeNodeData();
    dataRight.vertex=cp;
              nodeRight=new pTwoChildNode(dataRight);
    nodeParent.setRight(nodeRight);
    dataLeft=new treeNodeData();
    dataLeft.vertex=cc;
              nodeLeft=new pTwoChildNode(dataLeft);
    nodeParent.setLeft(nodeLeft);
    treeArray[e].setRoot(nodeParent);
         static void preOTrav(pTwoChildNode n) {
              if (n == null)
              return;
              dataParent=(treeNodeData)n.getData();
              System.out.print(dataParent.vertex+" ");
              preOtrav(n.getLeft());
              preOtrav(n.getRight());
    //problems are here!!!!!
    class treeNodeData {
         int vertex;
         // data element2 -> a set of vertex fan;
    It doesn't compile but with the message saying that can not resolve the symbol in preOTrav(n.getLeft()); and preOTrav(n.getRight());
    Please help!

              preOtrav(n.getLeft());
              preOtrav(n.getRight());Don't write preOtrav when you mean preOTrav. Java is case-sensitive.
    Jesper

  • Error message when adding video to premiere pro, please help!

    Hi there,
    Every time I try and add a video to premiere pro I get an error message "There was an error decompressing audio or video." I made the video in After effects and it plays just fine but I wanted to add sound to it in premiere pro. The file is mpeg movie, I can get more info if needed, just let me know. I am not very experienced at all in adobe but i'm learning so if someone could please help, that'd be awesome? P.S i'm using a MAC

    You're welcome.
    I've never visited Paris but it is on my list.
    I don't believe the 10.4.4 Update had anything to do with this. I also have a .Mac account and I didn't experience any problems sending with any of my accounts and different SMTP servers after installing the Update.
    Something to try.
    Go to the SMTP server settings for the .Mac SMTP server and in the Server Port field, enter 587 in place of 25 and when finished, select OK to save the changed setting.
    Test if this resolves the problem.
    Having the SSL warning message is odd if Use SSL is not selected for the SMTP server and if using 587 as the server port doesn't resolve the problem, this may be a Mail.app preference file problem which is the file that stores all account settings.

  • Random Numbers in JSSE - Please Help

    I am pulling what little hair I have out trying to figure out this problem, please help if you can - How can I programmatically retrieve at runtime the client and server nonces used to negotiate a SSL socket in JSSE?
    Regards,
    Bart

    Sorry - I wasn't very specific in my post I guess - I realize that you can output the nonces, etc. by running the debugger - but, I am hoping to use the nonces at runtime in the code. Thus, it is not so much that I can figure out what nonces were used to negotiate an SSL session, but that my program can use them to perform another task. Any idea how to get these values programmatically?
    Thanks,
    Tore

  • Need help with adding arrays to invoice.java please willing to pay?

    Using your Invoice class created in lab02, write a client program that allows the user to input three Invoice objects into an array of Invoice objects. After you have inputted all of the invoices, print a heading and then output all of the array elements (Invoice objects) by calling the method from your Invoice class that displays all of the data members on a single line using uniform field widths to insure that all Invoice objects will line up in column format (created in Lab04). At the end of the loop, display the calculated total retail value of all products entered in the proper currency format.
    Example of possible program execution:
    Part Number : WIDGET
    Part Description : A fictitious product
    Quantity : 100
    Price          : 19.95
    (etc.)
    Example of possible output
    Part Number          Part Description          Quantity          Price     Amount
    WIDGET          A fictitious product     100          19.95     199.95
    Hammer               9 pounds          10          5.00     50.00
    (etc.)
    Total Retail Value:                                   249.95
    This is what i have so far Invoice Test
    //Lab 2 InvoiceTest.java
    //Application to test class Invoice.
    //By Morris Folkes
    public class InvoiceTest
    public static void main( String args[] )
    Invoice invoice1 = new Invoice( "1234", "Hammer", 2, 14.95 );
    // display invoice1
    System.out.println( "Original invoice information" );
    System.out.printf( "Part number: %s\n", invoice1.getPartNumber() );
    System.out.printf( "Description: %s\n",
    invoice1.getPartDescription() );
    System.out.printf( "Quantity: %d\n", invoice1.getQuantity() );
    System.out.printf( "Price: %.2f\n", invoice1.getPricePerItem() );
    System.out.printf( "Invoice amount: %.2f\n",
    invoice1.getInvoiceAmount() );
    // change invoice1's data
    invoice1.setPartNumber( "001234" );
    invoice1.setPartDescription( "Blue Hammer" );
    invoice1.setQuantity( 3 );
    invoice1.setPricePerItem( 19.49 );
    // display invoice1 with new data
    System.out.println( "\nUpdated invoice information" );
    System.out.printf( "Part number: %s\n", invoice1.getPartNumber() );
    System.out.printf( "Description: %s\n",
    invoice1.getPartDescription() );
    System.out.printf( "Quantity: %d\n", invoice1.getQuantity() );
    System.out.printf( "Price: %.2f\n", invoice1.getPricePerItem() );
    System.out.printf( "Invoice amount: %.2f\n",
    invoice1.getInvoiceAmount() );
    Invoice invoice2 = new Invoice( "5678", "PaintBrush", -5, -9.99 );
    // display invoice2
    System.out.println( "\nOriginal invoice information" );
    System.out.printf( "Part number: %s\n", invoice2.getPartNumber() );
    System.out.printf( "Description: %s\n",
    invoice2.getPartDescription() );
    System.out.printf( "Quantity: %d\n", invoice2.getQuantity() );
    System.out.printf( "Price: %.2f\n", invoice2.getPricePerItem() );
    System.out.printf( "Invoice amount: %.2f\n",
    invoice2.getInvoiceAmount() );
    // change invoice2's data
    invoice2.setQuantity( 3 );
    invoice2.setPricePerItem( 9.49 );
    // display invoice2 with new data
    System.out.println( "\nUpdated invoice information" );
    System.out.printf( "Part number: %s\n", invoice2.getPartNumber() );
    System.out.printf( "Description: %s\n",
    invoice2.getPartDescription() );
    System.out.printf( "Quantity: %d\n", invoice2.getQuantity() );
    System.out.printf( "Price: %.2f\n", invoice2.getPricePerItem() );
    System.out.printf( "Invoice amount: %.2f\n",
    invoice2.getInvoiceAmount() );
    } // end main
    } // end class InvoiceTest

    i suck in java There are 2 possible reasons for this:
    1. you haven't studied
    2. you aren't cut out for programming
    and there r hardly any tutors at my school. plus i work 2 jobs day n night. Please, I'm only want help thats allYou have the help of the ENTIRE WORLD COMMUNITY right here, right now. But you're not willing to make any effort whatsoever. You think people will help or even respect you? You may fail your class and you may fail in life!
    Cheaters don't win and winners don't cheat!

  • New to Java, Please help

    Hi, I was trying to play a game and came up with this java error (below), I uninstalled and reinstalled still no fix. I think i need a new class?, If anyone can explain the potential problem to me and help me fix it, that would be much appreciated. I'm a complete NEWB when it comes to java, I'm not even sure how to edit that code. so please remember to explain in the newbiest of newby answers. I am proficient with features of a computer just not java.
    Java Plug-in 1.6.0_24
    Using JRE version 1.6.0_24-b07 Java HotSpot(TM) Client VM
    User home directory = C:\Users\Ethan
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    load: class loader.class not found.
    java.lang.ClassNotFoundException: loader.class
    at sun.plugin2.applet.Applet2ClassLoader.fi… Source)
    at sun.plugin2.applet.Plugin2ClassLoader.lo… Source)
    at sun.plugin2.applet.Plugin2ClassLoader.lo… Source)
    at sun.plugin2.applet.Plugin2ClassLoader.lo… Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.lo… Source)
    at sun.plugin2.applet.Plugin2Manager.create… Source)
    at sun.plugin2.applet.Plugin2Manager$Applet… Source)
    at java.lang.Thread.run(Unknown Source)
    Exception: java.lang.ClassNotFoundException: loader.class

    845681 wrote:
    Hi, I was trying to play a game and came up with this java error (below), I uninstalled and reinstalled still no fix. I think i need a new class?, If anyone can explain the potential problem to me and help me fix it, that would be much appreciated. I'm a complete NEWB when it comes to java, I'm not even sure how to edit that code. so please remember to explain in the newbiest of newby answers. I am proficient with features of a computer just not java.If you want to learn how to program java, which is not the same as playing that particular game then you can start with the following link.
    http://download.oracle.com/javase/tutorial/getStarted/index.html

  • Fundamental questions in Java, please help to answer.

    I am a beginner of a Java Programming. Although I had few programming experiences on Java. But there are few conceptal questions. Hope every experts can help to explain more to me.
    1. How <b>Encapsulation</b> works in Java? Why is it needed? What benefits can be given from encapsulation? Can give some examples for me to know more?
    2. How <b>Overloading</b> works in Java? Why is it needed? What benefits can be given from it in the extensibility of programs? Can give some examples for me to know more?
    3. How <b>inheritance</b> works in Java? What benefits can be given from inheritance? Can give further explanation, such as class hierarchy for me to know more?
    4. What is <i>object class</i> and <i>object distances</i> ? What is their differences?
    5. What is <b>Reusability</b>? What benefits can it gives? Why it is needed? Can give me further examples?
    Thanks for help very much

    Maybe I'm not getting this, but you want one of us to give you a nice short answer convenient enough for you to copy down, right? Well, there aren't many people here that are willing to do that. There are many people who won't even bother answering homework questions. I don't mind, but you need to show us some work you've done, like the previous poster said. The effort has to come from you, not us. If you are learning Java, you must put some effort into it.
    How can you get an answer out of us?
    Example: I understand that inheritance is ..............., but I'm not sure about this part.............. Can anyone provide some clarification please?
    Anyway, this question has been crossposted on at least 5 forums already, which I'm sure is one of the reasons people aren't bothering with this question. Please DO NOT CROSSPOST, it's considered poor forum etiquette.
    Please don't take anything that I said negatively, but you have to understand that we are taking our time to respond to your queries, and asking us to provide short answers without doing any work on your part, and crossposting is not going to get you answers out of us.
    Cheers

  • Totally New in Java - Please help!!

    Hi Dear all,
    l am totally new in Java, and l facing one problem,and really hope can get some help from yours,please!
    l need to write this program:
    The program should do the following:
    1. Input two fields: action (action: add / delete), and account number (any
    digit or character)
    2. if the action is "add" then the program adds one text line to a text
    file.
    "New account is <account number>"
    3. create the text file if it is not already exist (in c:\)
    4. When program runs again with new input values, a new line will be
    appended to the same file.
    5. if the action is "delete" then the program finds the record and removes
    the text line from the file.
    My problem is :
    l just know that l need to create the user interface first,but l don't know how to go on??
    Would you please show me some step how to solve these problem?
    Many many thanks!!
    BaoBao

    I don't know about Swing. I never use it.
    The stuff to create and manipulate files is in the java.io package.
    You'll probably want to use java.io.FileReader and java.io.FileWriter.
    Note that FileWriter has a constructor that lets you append and not overwrite.
    I'll start you off with a test.
    public class AccountListAddTest() {
      public static void main(String[] argv) {
        AccountList accts = new AccountList();
        accts.add("abcdefg12345"); // arg is a hypothetical account number
    }Write an AccountList class that'll work if you compile and run this test. After you run this test for the first time, the file should contain the string
    New account is abcdefg12345.
    This test assumes that the filename is hardcoded into the AccountList class. To keep it simple, make the add method create a new appending FileWriter each time, write, then close the writer.

  • TS3899 Can't send or receive email on iPhone 5 nor my iPad 2?  Tried hard resetting, deleting account then adding again-- no luck!  Please help!!

    CAn someone please tell me how to fix my email problem-- all of a sudden I can't receive or send email-- it's an Apple problem-- cause I can get online-- tried the hard reset and deleting account and adding again-- no luck
    thanks
    mary

    you still didn't answer the question.... unless you mean to say that you have an AT&T e-mail account. (e.g. @att.net)
    If that's what you mean, they use Yahoo for e-mail services. Yahoo's mail servers are notoriously bad. This comes up here at least several times a week. The problem is on the Yahoo end. Trust me, the AT&T rep you spoke to doesn't know what they are talking about. Removing and re-adding the account increases the odds that you will actually hit a working server, but it's not guaranteed to do so.
    Set up a gmail account or iCloud account and consider switching.

Maybe you are looking for