Float - string

I have float BMIndex and I would like to display the number in a panel. I think the only way I can do this is to copy float BMIndex to string BMIstring, but I can't figure out how. There doesn't seem to be a parse method in string, and the few things I've triend online don't seem to want to accept a float as an argument.
All I want to do is copy float BMIndex to string BMIstring =(
Please help

Try this:
class A
      static public void main(String arg[])
      float f = 1.2345f;
      double d = 987.654;
      String F,D;
      F = Float.valueOf(f).toString();
      D = Double.valueOf(d).toString();
      System.out.println("Printed as strings:");
      System.out.println(F);
      System.out.println(D);
      System.out.println("Printed as float and double:");
      System.out.println(f);
      System.out.println(d);
}The primitive type float is no class and has no toString method. Float(f).valueOf converts the float f to an object of type Float. Call the method toString in this object instead. As you can see it is possible
to print floats directly as well.
/David

Similar Messages

  • Convert double precision float string to a number

    I am a newbie with Labview.
    I have a GPIB link with a vector voltmeter and I receive the data as a double precision float string (IEEE standard 754-1985). I would like it to be recognized as a number, but I can't find the proper conversion function. The string to convert is 8 byte long. Does anyone have an idea how to do it? Thank you!

    Asumming your data is big-endian, you should be able to simply typecast it to a DBL (see attache LV 7.0 example).
    (It is possible that your DBL string is little-endian, in this case it will be slightly more complicated. Let us know )Message Edited by altenbach on 05-27-2005 04:49 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    StringToDBL.vi ‏23 KB

  • Display Large Float w/o Scientific Notation

    I have a series of dollar amounts (from an SQL cursor) that I am summing up using a java.lang.Float. The values total correctly, but when I display the value it is displayed using Scientific Notation (4.19150150185925 E12). I need to write my total value to a file that will be exported to another application (mainframe). Therefore, the value when written to the output file must be 4191501501859.25. How do I get the value in that form, instead of the scientific notation form?
    Should I be using a different type to sum my values into? The max value my total can reach is 99999999999999999.999
    Thanks.

    No, I meant precisely what I said. If BigDecimal
    does indeed have a valueOf method that accepts a
    string, please notify Sun, as they will certainly
    have to update the documentation -- didn't YOU
    read the documentation link that you yourself
    sent me?
    No, of course not, I only checked that it indeed does not have any method that takes a String parameter and that the method to "add" numbers is really called "add".
    By the way, a constructor that takes a String parameter does pretty much the same thing as a method that takes a String parameter and returns a new instance of the class. There is no significant difference between Float's valueOf(String) and the Float(String) constructor as far the user of the API is concerned.
    (Looking up the source just for fun I see that Float.valueOf(String) and Float(String) do completely different things, and Float(String) creates a temporary extra Float object. The comment above says: "REMIND: this is inefficient". Interesting.)
    Probably not, you were apparently too busy taking
    a 'tude.No doubt! :-)

  • A problem with ArrayLists

    Hello
    I'm pretty new to Java, and sometimes all those objects, instances, classes, data types etc confuse me. I'm having some kind of a problem with ArrayLists (tried with vectors too, didn't work) . I'm writing a program which takes float numbers from user input and does stuff to them. No syntax error in my code, but I get a java.lang.ClassCastException when I run it.
    I insert stuff to the ArrayList like this:
    luku.add(new Float(syotettyLuku));no problem
    I'm trying to access information from the list like this inside a while loop
    float lukui = new Float((String)luku.get(i)) .floatValue();but the exception comes when the programme hits that line, no matter which value i has.
    Tried this too, said that types are incompatible:
    float lukui = ((float)luku.get(i)) .floatValue();What am I doing wrong? I couldn't find any good tutorials about using lists, so i'm really lost here.
    I'll post the whole code here, if it helps. Sorry about the Finnish variable and method names, but you get the idea :)
    package esa;
    import java.io.*;
    import java.util.*;
    public class Esa {
    static final int maxLukuja = 100;
    static BufferedReader syote = new BufferedReader(new InputStreamReader(System.in));
    static String rivi;
    static String lopetuskasky = "exit";
    static double keskiarvo;
    static ArrayList luku = new ArrayList();
    static int lukuja;
    static float summa = 0;
    // M��ritell��n pari metodia, joiden avulla voidaan tarkastaa onko tarkasteltava muuttuja liukuluku
    static Float formatFloat(String rivi) {
        if (rivi == null) {
            return null;
        try {
            return new Float(rivi);
        catch(NumberFormatException e) {
            return null;
    static boolean isFloat(String rivi) {
        return (formatFloat(rivi) != null);
    // Luetaan luvut k�ytt�j�lt� ja tallnnetaan ne luku-taulukkoon
    static void lueLuvut() throws IOException{
        int i = 0;
        float syotettyLuku;
        while(i < maxLukuja) {
            System.out.println("Anna luku kerrallaan ja paina enter. Kun halaut lopettaa, n�pp�ile exit");
            rivi = syote.readLine();
            boolean onkoLiukuluku = isFloat(rivi);
            if (onkoLiukuluku) {
                syotettyLuku = Float.parseFloat(rivi);
                if (syotettyLuku == 0) {
                    lukuja = luku.size();              
                    break;
                }  // if syotettyluku
                else {
                    luku.add(new Float(syotettyLuku));
                    i++;
                } // else
            } // if onkoLiukuluku
            else {
               System.out.println("Antamasi luku ei ole oikeaa muotoa, yrit� uudelleen.");
               System.out.println("");
            } // else
        } // while i < maxlukuja
    // lueLuvut
    static void laskeKeskiarvo() {
        int i = 0;
        while(i < lukuja) {
            float lukui = ((float)luku.get(i)) .floatValue();
            System.out.println(lukui);
            summa = summa + lukui;
        }   i++;
        keskiarvo = (summa / lukuja);
    } // laskeKeskiarvo
    public static void main(String args[]) throws IOException {
    lueLuvut();
    laskeKeskiarvo();
    } // main
    } // class

    Thanks! Now it's functioning.
    As I mentioned, I tried this:
    float lukui = ((float)luku.get(i))
    .floatValue();And your reply was:
    float lukui =
    ((Float)luku.get(i)).floatValue So the problem really was the spelling, it should
    have been Float with a capital F.
    From what I understand, Float refers to the Float
    class, Correct. And float refers to the float primitive type. Objects and primitives are not interchangeable. You need to take explicit steps to convert between them. Although, in 1.5/5.0, autoboxing/unboxing hide some of this for you.
    so why isn't just a regular float datatype
    doing the job here, like with the variable lukui?Not entirely sure what you're asking.
    Collections take objects, not primitives, and since you put an object in, you get an object out. You then have to take the extra step to get a primitive representation of that object. You can't just cast between objects and primitives.
    Again, autoboxing will relieve some of this drudgery. I haven't used it myself yet, so I can't comment on how good or bad it is.

  • How to make the last argument of "GetMethodID"

    Hello all !!
    I'm knew in JNI programing.
    I'm trying to call a Java class from a C program...
    I'm wondering how do I make the last argument of "GetMethodID"...
    eg : to get Java methods declared as follows:
    -String method1(int, float, String)
    -String method2()
    -void method3(String, int)
    -void method4()
    Thanks
    Joly

    Formal definition is in the VM specification.
    [http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html#1169]
    Myself I use the javap command that comes with the jdk. Run it like the followng and study the output carefully.
    javap -c MyPackage.MyClass

  • Reading a text data file into memory

    hi,
    I have a text file which contains data, The text file is parsed and objects are created. The problem is the text file is quite huge measuring upto 1.8~2 Mb. The format of the text file is as follows
    Units: METRIC (atm, m3)
    * Step: 1 Time: 0.00
    * Average Field Pressure : 204.14
    * Region 1 Pressure : 204.14
    Well GROUP Layer Blk_Pressure BHP ResRate OilRate WaterRate GasRate KhProd Windex PindeWELLTYPE
    1 FIELD 1 204.14 49.33 6601.22 6568.10 37.14 538.07 99999.00 260.35 99999.00 P
    1 FIELD 2 204.14 50.34 6558.13 6525.23 36.90 534.56 99999.00 260.35 99999.00 P
    1 FIELD 3 204.14 51.35 6515.04 6482.36 36.65 531.04 99999.00 260.35 99999.00 P
    1 FIELD Tot 204.14 50.34 19674.40 19575.69 110.69 1603.67 99999.00 99999.00 99999.00 P
    2 FIELD 1 204.14 377.66 7573.96 0.00 7403.68 0.00 99999.00 260.35 99999.00 I
    2 FIELD 2 204.14 378.40 7606.33 0.00 7435.32 0.00 99999.00 260.35 99999.00 I
    2 FIELD 3 204.14 379.14 7638.70 0.00 7466.96 0.00 99999.00 260.35 99999.00 I
    2 FIELD Tot 204.14 378.40 22818.99 0.00 22305.95 0.00 99999.00 99999.00 99999.00 I
    * Step: 2 Time: 20.23
    * Average Field Pressure : 300.11
    * Region 1 Pressure : 300.11
    Well GROUP Layer Blk_Pressure BHP ResRate OilRate WaterRate GasRate KhProd Windex PindeWELLTYPE
    1 FIELD 1 194.20 49.33 858.83 853.40 5.36 68.22 99999.00 260.35 99999.00 P
    1 FIELD 2 194.48 50.34 871.71 866.22 5.42 69.35 99999.00 260.35 99999.00 P
    1 FIELD 3 194.76 51.35 884.86 879.29 5.48 70.49 99999.00 260.35 99999.00 P
    1 FIELD Tot 194.48 50.34 2615.40 2598.91 16.26 208.06 99999.00 99999.00 99999.00 P
    2 FIELD 1 370.40 377.66 912.25 0.00 891.74 0.00 99999.00 260.35 99999.00 I
    2 FIELD 2 371.26 378.40 895.75 0.00 875.61 0.00 99999.00 260.35 99999.00 I
    2 FIELD 3 372.12 379.14 879.29 0.00 859.52 0.00 99999.00 260.35 99999.00 I
    2 FIELD Tot 371.26 378.40 2687.28 0.00 2626.86 0.00 99999.00 99999.00 99999.00 I
    The Step goes on till like 3000, I am creating an object for each step which inturn has nested object for each well and the well in turn for each layer. In the above case of step 3 the object would be
    class Step 2{
    inner class well
    {     //for well 1
    inner class layer { // for layer 1 }
    inner class layer {/ for layer 2  }
    inner class layer {/ for layer 3  }
    inner class well
    {     //for well 2
    inner class layer { // for layer 1 }
    inner class layer {/ for layer 2  }
    inner class layer {/ for layer 3  }
    This architecture of mine is proving to be heavy as I would end up with around 9000 Java objects in memory, though my classes only have have int, float, String data items. I am using this data to plot graphs, so I guess it wouldnt be optimal to read data from text file for each plot.
    So in short the problem is can anyone tell a better way to read the data into memory ? given that there could be 3000 steps in the format given above.
    Thanks
    AM

    I have implemented and it takes around 30-45 sec to parse and also the GUI has become very slow. I query the objects for multiple combinations of graphs.
    The data from the objects is being used to feed the graphs on my GUI. I have a number of options on my GUI for different kinds of graphs, for each combination chosen the Objects are queried for the data. The GUI is written using Swing.
    So is there anyway I can fine tune the application, any tips about the object architecture or how to improve the speed. I am also explicitly running the garbage collector a few times in my program. Also how can I make JVM occupy lesser memory so that my program can have more memory.
    Thanks
    am

  • Getting clusters from LabVIEW ActiveX Server with Excel/VBA

    Hello,
    my colleague and I are trying to control a LV from Excel (VBA) by ActiveX.
    I.E.:
    We do something like :
    Set LV = createObject("LabVIEW.Application")
    Set VI = LV.GetVIReference("Path_to_VI")
    ParamNames(0) = "Input1"
    ParamNames(1) = "Input2"
    ParamNames(2) = "Output"
    ParamValues(0) = 1
    ParamValues(1) = 3.1415
    Call VI.Call(ParamNames,ParamValues)
    msgbox("output =" & ParamVals(2))
    This works perfectly for simple data types (int, double, float, string, etc )
    Now we need to transfer more complex structures, which are originaly LV-clusters.
    But we did not find any clue on how do that (especially receive clusters) in the help or on the internet.
    Is there any chance to succeed ???
    TIA,
    Thomas

    Actually, working with clusters is really really easy. Through the magic of - well something - a cluster in LV comes out in the VBA environment as an array of variants. There was an activex example that shipped with V7.1 that showed this very thing. I couldn't find them in V8 so here is the 7.1 stuff.
    Check out the macros in the Excel spreadsheet... This show running the VI in the development environment, but if this looks interesting I can fill you in on how to make it work in an executable.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps
    Attachments:
    freqresp.xls ‏49 KB
    Frequency Response.llb ‏155 KB

  • Pb to connecting to the demo database

    hi ,
    i'm newbie :)
    i have just installed TimesTen with demo ,
    i can't see how can i connect to the demo database in the command line (i'm on Linux)
    what's the name of the demo database ?
    thanks for help
    :)

    Y.Brunet, I can not be as sure in my words as you are, since I don't know how other companies and programmers solve these problems, but I cannot easily accept your advice to code dates as Strings.
    In our company's projects everywhere in DB handling code we use PreparedStatements because AFAIK they provide better performance than CallableStatements if frequently used. Also they provide abstraction level - why should I know how the f!@# the Database expects dates/int/float/String... in SQL statements?
    We use several DB servers - M@SQL, Access, Oracle, Ingres - they all handle dates in different way(not to mention that in most DBs date format is customizable). But code written for one server works on others (most of it, of course) because of this level of abstraction.
    Let's leave the driver format the stuff as the DB expects and concentrate on the real work - pass correct values, perform logical checks, improving performance.....
    Mike

  • Pb to transfert Date in access Database

    Hi,
    I have a problem to transfert date in access database.
    I get the date in java:
    Calendar theCalendar = java.util.Calendar.getInstance();
    int month = theCalendar.get(Calendar.MONTH)+1;
    int dayOfMonth = theCalendar.get(Calendar.DAY_OF_MONTH);
    String dateString = new Integer(theCalendar.get(Calendar.YEAR)).toString();
    dateString = dateString + "-" + month + "-" + dayOfMonth ;
    then I update the statement (odbc) , everything is ok except that for the dateString =2004-05-11, when I look in my database (field defined as Date/Time), I read 6/10/1905 witch is "little" different.
    I try to do a Date rightNow = java.sql.Date.valueOf(dateString); and put the rightNow in the statement , equal !
    I try also to change the dateString with yyyy/mm/dd then I get strange values in access
    Does somebody could help me, I'm a beginner,
    thank a lot

    Y.Brunet, I can not be as sure in my words as you are, since I don't know how other companies and programmers solve these problems, but I cannot easily accept your advice to code dates as Strings.
    In our company's projects everywhere in DB handling code we use PreparedStatements because AFAIK they provide better performance than CallableStatements if frequently used. Also they provide abstraction level - why should I know how the f!@# the Database expects dates/int/float/String... in SQL statements?
    We use several DB servers - M@SQL, Access, Oracle, Ingres - they all handle dates in different way(not to mention that in most DBs date format is customizable). But code written for one server works on others (most of it, of course) because of this level of abstraction.
    Let's leave the driver format the stuff as the DB expects and concentrate on the real work - pass correct values, perform logical checks, improving performance.....
    Mike

  • Using web logic 6.1 web service

    hello.
    I'm testing web services in weblogic 6.1
    I have created a web service and client. they exchange messages well.
    their request and Response messages are like below
    request Message------------------------------------------------------------------------------------
    POST /weather/weatheruri HTTP/1.1
    Content-length: 483
    <?xml version='1.0' encoding='UTF-8'?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
    xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
    xmlns:xsd='http://www.w3.org/1999/XMLSchema'><SOAP-ENV:Body><ns0:getTemp xmlns:ns0='urn:Weather'
    SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
    <arg0 xsi:type='xsd:string'>SomeString</arg0>
    </ns0:getTemp>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    Response Message-------------------------------------------------------------------------------------
    HTTP/1.1 200 OK
    Date: Mon, 08 Sep 2003 02:08:02 GMT
    Server: WebLogic WebLogic Server 6.1 SP2 12/18/2001 11:13:46 #154529
    Content-Type: text/xml; charset=UTF-8
    Transfer-Encoding: Chunked
    Connection: Close
    0291
    <?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
    xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
    xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
    <SOAP-ENV:Body>
    <ns0:getTempResponse xmlns:ns0='urn:local' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
    <return xsi:type='bean:weatherResult' xmlns:bean='java:examples.webservices.rpc.weather'
    >
    <temperature xsi:type='xsd:float'>-273.15</temperature>
    <zipcode xsi:type='xsd:string'>SomeString</zipcode>
    </return>
    </ns0:getTempResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    0000
    they seems to work fine.
    but i'm getting error to decode response message on client side.
    C:\... >java Client
    java.lang.reflect.UndeclaredThrowableException: java.lang.InstantiationException
    : examples.webservices.rpc.weather.weatherResult
    at weblogic.soap.codec.SimpleSoapEncodingCodec.newInstance(SimpleSoapEnc
    odingCodec.java:198)
    at weblogic.soap.codec.SimpleSoapEncodingCodec.decode(SimpleSoapEncoding
    Codec.java:178)
    at weblogic.soap.codec.SimpleSoapEncodingCodec.decode(SimpleSoapEncoding
    Codec.java:151)
    at weblogic.soap.codec.CodecFactory.decode(CodecFactory.java:96)
    at weblogic.soap.codec.Operation.read(Operation.java:100)
    at weblogic.soap.codec.SoapMessage.readOperation(SoapMessage.java:200)
    at weblogic.soap.codec.SoapMessage.read(SoapMessage.java:130)
    at weblogic.soap.WebServiceProxy.receive(WebServiceProxy.java:464)
    at weblogic.soap.WebServiceProxy.invoke(WebServiceProxy.java:430)
    at weblogic.soap.SoapMethod.invoke(SoapMethod.java:186)
    at weblogic.soap.wsdl.WebServiceInvocationHandler.invoke(WebServiceInvoc
    ationHandler.java:31)
    at $Proxy0.getTemp(Unknown Source)
    at Client.main(Client.java:18)
    Exception in thread "main" java.lang.NullPointerException
    at Client.main(Client.java:23)
    weatherResult bean is like below.
    package examples.webservices.rpc.weather;
    public class weatherResult implements java.io.Serializable{
         private     String zipcode;
         private float temperature;
         public weatherResult ( String temp , float temp2 ) {
              this.zipcode = temp;
              this.temperature = temp2;
         public String getZipcode()
              return this.zipcode;
         public float getTemperature()
              return temperature;
         public void setZipcode(String temp)
              this.zipcode = temp;
         public void setTemperature(float temp)
              temperature = temp;
    what is problem you guess.. ?

    yes. service provider and consumer both are generated in weblogic.
    the only thing i did is to revise the 'weather' web service example to use java
    bean ( complex type ).
    ( the 'weather' web service example was in Document 'Programming WebLogic Web
    services' )
    thanks for quick response.
    Sam Pullara <[email protected]> wrote:
    Hmmm. Is this all being generated in WebLogic or are you using an external
    service? I think you should contact support. We may not support this
    in 6.1
    and you might have to move to 7.0 for more complete web service support.
    Sam
    dolso wrote:
    thanks for response.
    I have checked WSDL and i found another mystery.
    In my WSDL document that is generated in webLogic 6.1,
    'weatherResult' element's schema is like below
    <complexType name="weatherResult">
    <attribute name="temperature" type="float" />
    <attribute name="zipcode" type="string" />
    </complexType>
    as you can see, return element is supposed to be named 'weatherResult'and composed
    of attributes
    but responsed element is like below
    <return xsi:type='bean:weatherResult' xmlns:bean='java:examples.webservices.rpc.weather'>
    <temperature xsi:type='xsd:float'>-273.15</temperature>
    <zipcode xsi:type='xsd:string'>SomeString</zipcode>
    </return>
    there are two strange things.
    1. there is 'return' element .
    2. 'temperature' and 'zipcode' are elements, not attributes.
    where did 'return' element come from? and why response element is composedof
    elements?
    why it doesn't match up to WSDL document?
    I think that this problem caused error to instantiate weatherResultBean.
    do you know why?
    thanks for reading.
    Sam Pullara <[email protected]> wrote:
    It looks to me like you are returning a temperature and a zipcode but
    your
    weather result is expecting a zipcode and a temperature so the constructor
    is
    being called with a (float, String) rather than a (String, float).
    At
    least
    that is my guess. Maybe the two are listed in the other order in the
    WSDL?
    Sam
    dolso wrote:
    hello.
    I'm testing web services in weblogic 6.1
    I have created a web service and client. they exchange messages well.
    their request and Response messages are like below
    request Message------------------------------------------------------------------------------------
    POST /weather/weatheruri HTTP/1.1
    Content-length: 483
    <?xml version='1.0' encoding='UTF-8'?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
    xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
    xmlns:xsd='http://www.w3.org/1999/XMLSchema'><SOAP-ENV:Body><ns0:getTemp
    xmlns:ns0='urn:Weather'
    SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
    <arg0 xsi:type='xsd:string'>SomeString</arg0>
    </ns0:getTemp>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    Response Message-------------------------------------------------------------------------------------
    HTTP/1.1 200 OK
    Date: Mon, 08 Sep 2003 02:08:02 GMT
    Server: WebLogic WebLogic Server 6.1 SP2 12/18/2001 11:13:46 #154529
    Content-Type: text/xml; charset=UTF-8
    Transfer-Encoding: Chunked
    Connection: Close
    0291
    <?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
    xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
    xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
    <SOAP-ENV:Body>
    <ns0:getTempResponse xmlns:ns0='urn:local' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
    <return xsi:type='bean:weatherResult' xmlns:bean='java:examples.webservices.rpc.weather'
    <temperature xsi:type='xsd:float'>-273.15</temperature>
    <zipcode xsi:type='xsd:string'>SomeString</zipcode>
    </return>
    </ns0:getTempResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    0000
    they seems to work fine.
    but i'm getting error to decode response message on client side.
    C:\... >java Client
    java.lang.reflect.UndeclaredThrowableException: java.lang.InstantiationException
    : examples.webservices.rpc.weather.weatherResult
    at weblogic.soap.codec.SimpleSoapEncodingCodec.newInstance(SimpleSoapEnc
    odingCodec.java:198)
    at weblogic.soap.codec.SimpleSoapEncodingCodec.decode(SimpleSoapEncoding
    Codec.java:178)
    at weblogic.soap.codec.SimpleSoapEncodingCodec.decode(SimpleSoapEncoding
    Codec.java:151)
    at weblogic.soap.codec.CodecFactory.decode(CodecFactory.java:96)
    at weblogic.soap.codec.Operation.read(Operation.java:100)
    at weblogic.soap.codec.SoapMessage.readOperation(SoapMessage.java:200)
    at weblogic.soap.codec.SoapMessage.read(SoapMessage.java:130)
    at weblogic.soap.WebServiceProxy.receive(WebServiceProxy.java:464)
    at weblogic.soap.WebServiceProxy.invoke(WebServiceProxy.java:430)
    at weblogic.soap.SoapMethod.invoke(SoapMethod.java:186)
    at weblogic.soap.wsdl.WebServiceInvocationHandler.invoke(WebServiceInvoc
    ationHandler.java:31)
    at $Proxy0.getTemp(Unknown Source)
    at Client.main(Client.java:18)
    Exception in thread "main" java.lang.NullPointerException
    at Client.main(Client.java:23)
    weatherResult bean is like below.
    package examples.webservices.rpc.weather;
    public class weatherResult implements java.io.Serializable{
         private     String zipcode;
         private float temperature;
         public weatherResult ( String temp , float temp2 ) {
              this.zipcode = temp;
              this.temperature = temp2;
         public String getZipcode()
              return this.zipcode;
         public float getTemperature()
              return temperature;
         public void setZipcode(String temp)
              this.zipcode = temp;
         public void setTemperature(float temp)
              temperature = temp;
    what is problem you guess.. ?

  • Any good way to sort an ArrayList??

    I have a ArrayList now which must be sorted by the order such as:
    All
    string
    message
    number
    float
    My arrayList may only contains some of them, lets say{"float","string","number"}. how can I make this sort?
    thanks for any advice.

    Use Collections.sort, and write your ownComparator.
    If you store String objects you don't need a
    Comparator because String implements the Comparable
    Interface so their ordering is already defined. You
    just use Collections.sort on the ArrayList.Except that the ordering required by the original
    poster is goofy (non-alpha ordering), so the default
    String comparitor will not suffice...
    So, the answer is: "Use Collections.sort, and write
    your own Comparator".
    (Darned those pesky requirements :-) )
    - KAnd it's pesky when the OP never comes back and makes clarifications. I interpreted the list given as the input list, not the resulting sorted list. If it was already sorted he wouldn't need a program at all would he! -:)

  • Hard to Write Good Getters/Setters

    I am thinking about writing a complex wrapper to set and get any floats/strings/ints. Cause hate how OBJ-C handles these references/values and having to deal with headers and main files everytime something changes is a real big headache. On top I hate having to decide if your instance variable should be handled like a reference (which can be shared) or a value (which cannot). Most of the time you want value semantics, but implementation efficiency often makes folks choose reference semantics. Your decision effects how you write your getters/setters. Had to figure this out for myself, as I never found any good explanation of it.
    Not only do you have to deal with the reference/value semantics issue, but reference counting, threading and exceptions also complicate the issue.
    I am should just write a class to handle all this junk and use the #import so I dont have so much incredible redundant code that OBJ-C somehow needs.
    my plan:
    MyClass.SetInt(intname, x);
    SetInt, this will overwrite/declare an existing int variable by that name held in the class.
    x = MyClass.GetInt(intname);
    GetInt, this retrieves an existing int variable by that name held in the class - or returns nil if undeclared.
    but this is all fantasy, still .... I just might try it.

    well, i've been asked to do it.
    I'll make a short overview : I have a program that creates an XML file with some information about a workflow diagram. The company that requires this software wants to get the execution trace that create the XML file, apart from the XML itself, so they can freely modify it without the need of using my app. My app uses their libraries to write the XML. They could overwrite the XML directly but they already got the libraries and the parser to access each element.
    So, they want the execution trace of the code that generates the XML.I think you're going to be far better off inserting logging statements into your code, and building a small self-contained example from the output of those statements.
    If you don't want to do that, and are comfortable with JNI, you can write a trace agent using JVMTI
    Or, you can use aspect-oriented programming to add cutpoints to their methods, with a tool such as [Aspect-J|http://www.eclipse.org/aspectj/]
    There's also a "trace" command in JDB. Haven't used it, so can't tell you whether it will tell you everything you need.
    And there used to be a tracing interface that could be accessed from Java code. At least I seem to remember writing a trace utility in Java. Could be that it's available on the JRockit JVM and not Sun.

  • Could error check this code

    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.lang.Math.*;
    import javax.swing.*;
    public class YValue extends JApplet implements ActionListener
        JTextField xminField;
        JTextField xmaxField;
        JTextField iterField;
        JTextArea xyvalArea;
        JLabel xminLabel;
        JLabel xmaxLabel;
        JLabel iterLabel;
        JLabel xyvalLabel;
        JButton calcButton;
        public void init()
            setBounds(500, 500, 500, 500);
            Container pane = getContentPane();
            pane.setLayout(null);
            xminField           = new JTextField();
            xminField.setBounds(70, 10, 60, 25);
            xmaxField           = new JTextField();
            xmaxField.setBounds(70, 40, 60, 25);
            iterField          = new JTextField();
            iterField.setBounds(70, 70, 60, 25);
            xyvalArea          = new JTextArea();
            xyvalArea.setEditable(true);
            xyvalArea.setBounds(10, 130, 200, 200);
            JScrollPane scrollPane = new JScrollPane(xyvalArea);
            scrollPane.setBounds(10, 130, 200, 200);
            pane.add(scrollPane);
            xminLabel           = new JLabel("X - Min:");
            xminLabel.setBounds(10, 10, 60, 25);
            xmaxLabel           = new JLabel("X - Max:");
            xmaxLabel.setBounds(10, 40, 60, 25);
            iterLabel          = new JLabel("Iteration:");
            iterLabel.setBounds(10, 70, 60, 25);
            xyvalLabel          = new JLabel("X, Y - Values:");
            xyvalLabel.setBounds(10, 100, 100, 25);
            calcButton          = new JButton("Calculate:");
            calcButton.addActionListener(this);
            calcButton.setBounds(150, 40, 90, 20);
            pane.add(xminLabel);
            pane.add(xminField);
            pane.add(xmaxLabel);
            pane.add(xmaxField);
            pane.add(iterLabel);
            pane.add(iterField);
            pane.add(xyvalLabel);
            pane.add(xyvalArea);
            pane.add(calcButton);
            setContentPane(pane);
              setVisible( true );
        public void actionPerformed(ActionEvent e)
              xyvalArea.setText("");
              // get values from fields and convert to float
              String xminStr      = xminField.getText();                         // get input as string
              int xmin           = Integer.parseInt(xminStr);               // convert to integer
              float xminFl      = Float.valueOf(xminStr).floatValue();     // convert to float
              String xmaxStr      = xmaxField.getText();                         // get input as string
              int xmax           = Integer.parseInt(xmaxStr);               // convert to integer
              String iterStr      = iterField.getText();                         // get input as string
              int iter           = Integer.parseInt(iterStr);               // convert to integer
              float iterFl      = Float.valueOf(iterStr).floatValue();     // convert to float
              // create variables for purposes of calculating distance between two X values
              int neg      = -1;                                                  // create variable with value minus one
              neg           = (xmin * neg);                                        // multiply minimum X value by -1 to get positive value
              int length      = (neg + xmax);                                        // add minimum and maximum X values to get distance between them
              float xmin2Fl = (xminFl * xminFl);                              // minimum X value squared reamins constant
              // loop which lasts the distance between two X values
              for(int i = 0; i<=length; i = i + iter)
                   float xmin2tmp      = (xminFl * xminFl);                    // current x2
                   float xmin3tmp     = (xmin2Fl - xmin2tmp);                    // minimum x2 minus current x2
                   double y           = Math.sqrt(xmin3tmp);                    // get square root of x2 - x*x
                   String output      = ("(" + xminFl +", "+ y + ")");     // output (x, y)
                   xyvalArea.append(output + "\n");                         // append to textArea with a new line
                   xminFl = (xminFl + iterFl);                               // move X value to next iterval point
    }the scroll bar wont work at all and a white box the size of the text area appears in the top left corner when i run the applet every so often...
    any help would be great.
    cheers

    this is whats happening..
    i copied .java file to new location, compiled and ran, still screws up every few times i run it.
    what is:
    http://img191.imageshack.us/img191/2439/whatis7sb.jpg
    what should:
    http://img191.imageshack.us/img191/5854/whatshud7md.jpg

  • Y Axis Labels replaced with "..." on redraw

    I recently switched to JavaFX 1.2.1, which seems to have fixed issues with charts leaking when their datapoints and axes are dynamically redrawn. However, every time I update the data, the Y axis labels get messed up--"100.0" becomes "10..." and "0.0" becomes "...". Does anyone know a way to fix this? Thanks!
    (Example code below generates a new random value every DATA_RATE seconds. Increase DATA_RATE to slow down the test.)
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.chart.LineChart;
    import javafx.scene.chart.part.NumberAxis;
    import javafx.animation.KeyFrame;
    import javafx.animation.Timeline;
    import java.util.Random;
    def DATA_RATE = 1s;
    def MAX_POINTS = 21;
    var testData : LineChart.Data[];
    var testDataSeries = LineChart.Series
        name: "Test Data",
        data: bind testData,
    var currTime: Integer = -1;
    var theChart : LineChart;
    public function run(): Void
        genRandData();
        genRandData();
        theChart = LineChart
            title: "Line Chart",
            data:
                testDataSeries,
            xAxis: NumberAxis
                tickUnit: 5,
                minorTickCount: 5,
                lowerBound: 0,
                upperBound: 20,
            yAxis: NumberAxis
                tickUnit: 25,
                minorTickCount: 5,
                lowerBound: 0,
                upperBound: 100,
        var theStage = Stage
            title: "Application title",
            width: 1000,
            height: 800,
            scene: Scene
                content:
                    theChart,
        Timeline
            repeatCount: Timeline.INDEFINITE,
            keyFrames :
                KeyFrame
                    time : DATA_RATE,
                    canSkip : true,
                    action: genRandData,
        }.play();
    function genRandData() : Void
        var rand = new Random();
        ++currTime;
        insert LineChart.Data
            xValue: currTime
            yValue: rand.nextInt(101);
        } into testData;
        if (currTime > theChart.xAxis.upperBound)
            theChart.xAxis.upperBound = currTime;
            theChart.xAxis.lowerBound = currTime - MAX_POINTS + 1;
        if (sizeof testData > MAX_POINTS)
            delete testData[0];
    }

    You should report this bug to Kenai (Jira) if not already there.
    The only workaround I found is to change the format, so that only non-significant zeroes are hidden by the tick's label:
    {color:#8000A0}*formatTickLabel: function (f: Float): String { "{%.2f f}" }*{color}

  • Noskipws, resetiosflags( ios::skipws) does not work

    The following short program shows that 'noskipws' does not work:
    stringstream ss;
    string s;
    ss << "this is a test";
    ss >> noskipws >> s;
    cout << s << endl;
    This prints 'this' only and ignores the rest of the ss content. I tried using resetiosflags( ios::skipws) but this does not work either.
    Does anyone has any idea? Is this a bug in the STL implementation?

    Hi sjsaunders,
    I would like to know if there is a way to redirect the contents of stringstream into a string using the >> operator. I know I can use the stringstream::str() but this is not good for me as I'm using >> for data conversion such as converting into integer, float, string, etc.
    Thanks,
    Naoki

Maybe you are looking for

  • Icloud drive not showing in settings - icloud

    Hi, I am in ios 8.1 and using iphone 5c. I am not able to find "iCloud Drive" in Settings -> iCloud menu in my iphone. Am i missing something? I can see iCloud Drive in the "icloud app for Windows" when i login using my icloud id in windows though. L

  • Technical requirement's for ALE/Idoc

    Hi all, Am new for ALE/IDOC we have requirement for ALE inbound and outbound scenarios , what are the mandatory requirements(port,partner profile, message type ..etc) from technical point of  view for Technical consultants, Regards Suresh.D

  • Can i combine pdf, word and powerpoint into 1 pdf, and add page number?

    hi, i've been tasked to create a proposal combining these document types into 1 pdf. does anyone know if i can add page number as well, before i pay for subscription? thank you!!

  • HT201269 I was setting up my iPhone5, selected apps, and now can't open it in iTunes. How can I get it back?

    I began the set up of my iPhone5, but now can't see the usual iTunes page for iPhone. How can I get it back and find my phone? iPhone is still connected, iTunes open and online.... apps are downloading ever so slowly.....nearly three hours now!

  • Re-authorization

    I had to do a hard recovery of my computer, and iTunes is asking me to reauthorize my account. When I did so, iTunes considers this to be another computer authorized to use the account. Any means to resolve this issue? It is the same computer. Thanks