New user for java (Data type conversion)

Hi all, I'm the newer from JAVA, just start to learn it few weeks before, there have some problem about me.
I want to konw how to change the data type ??For example, if I have a string call year and store the char "1", how can I change that field to int type ?
Thanks very much

You should have a link to, or download, the API docs. You can see them on line at:
http://java.sun.com/j2se/1.3/docs/api/index.html
Look up the class Integer. It has a static method, parseInt() which takes a String argument and returns an int.. Since it is static, you can do the following:
int value = Integer.parseInt(your_string);
Then, to make it robust, you can put try/catch around it and catch NumberFormatException if you need to do error checking.

Similar Messages

  • Invalid data type conversions

    what are the invalid data type conversions in ABAP ???
    Moderator message: please search for available information/documentation.
    Edited by: Thomas Zloch on Mar 10, 2012 6:01 PM

    No Amanda,
    The values that I see in message monitor are also those that comes to XSLT programs as input.
    I investigated our problem a little further myself:
    1) XI always converts messages into XML format - this everybody knows.
    2) In XI documentation it is declared that XI uses ISO 8601 for DATE type formatting. That's why you see dates in format YYYY-MM-DD in XML data in message monitoring.
    3) The appearance of those decimal values are not that obvious for me. If XI uses ABAP transformation for message content then applies the rules for converting ABAP data types into XML. For this there is a SAP document 'ABAP - XML mapping' from TechEd2004. This document seems to describe how ABAP data types are handled by XML transformation.
    Anyway, we currently need to play with decimal values in XSLT mapping programs inside XI:
    a) add leading 0 integer if source value < 1
    RFC returns 0.123 -> XI converts to XML '.123' -> XSLT mapper should return '0.123' ->SOAP response returns '0.123'
    b) add decimal point and trailing zeros
    RFC returns 0.000 -> XI converts to XML '0' -> XSLT mapper should return '0.000' ->SOAP response return '0.000'
    With dates, the problem is actually on documenting mapping rules when writing interface specifications. If you would write an EAI-solution-independent conversion rule (RFC/date->SOAP/char) for date field it could sound like: YYYYMMDD -> dd.mm.yyyy. This works semantically between these systems but would not work for XI-developer, because he get YYYY-MM-DD from the RFC.
    Additionally the decimal type conversion requirements in XSLT mapping programs probably only applies XI and are therefore not reusable in other EAI environments.
    I would be glad if somebody would still have further comments for this data type conversion issue.
    br: Kimmo

  • I transferred data from my Macbook Pro to my Mac mini but it forced me to make a new user for my old data.  How do I transfer my music, pics, and docs from the "old" user to the new user (so that I only have one user instead of 2?)

    I transferred data from my Macbook Pro to my Mac mini but it forced me to make a new user for my old data.  How do I transfer my music, pics, and docs from the "old" user to the new user (so that I only have one user instead of 2?)

    Unless you transfer the files from Setup Assistant, Migration Assistant creates a new user with the data.
    To transfer the files to your first user, you have to log on this new user, and copy all your files to /Users/Shard folder. This is a folder where you can put the files you want to share between two or more users, and all users can read and write in it.
    After copying the files, go to your first user, open /Users/Shared folder, and copy the files to your user folders. If you migrated applications, you must know that they are stored in a common folder (/Applications), so you don't have to transfer them. To open /Users/Shared folder, open Go menu (in the menu bar) > Go to Folder, and type the folder

  • Java rounding for Double data type

    Hi,
    Is there a way to change the default precision to 2 digits after decimal point for Double data type.

    java.text.DecimalFormat:
    import java.text.DecimalFormat;
    DecimalFormat format = new DecimalFormat("#.00");
    StringBuffer formatted = format.format(Math.PI, new StringBuffer(), new FieldPosition(0));
    System.out.println(formatted); // prints out 3.14Probably as applicable today as it was 3 years ago

  • Conversion of Packed Decimal Numbers to Java Data Types

    Hi all,
    I'm working with a mainframe file which contains datas in Packed Decimal Numbers.My requirement is to convert these datas to Java datatypes and also to convert the Java datatypes to Packed Decimal Numbers before storing them in the mainframe.
    Can anyone help me out with any code for converting Java data types to/from other data formats such as: EBCDIC, IBM370 COMP (binary numbers up to 9 digits), and COMP-16 (packed decimal numbers)?
    I would hugely appreciate any response to my query.
    Thanking you all,
    Kaushik.

    Rather than go that route, I'd instead look into providing a "service" on your mainframe to:
    1) provide a textual representation of the numbers (from native to text)
    2) read text, converting to native numeric storage
    And use that service to retrieve that information by your Java app (1)Similarly, instead of trying to write natively-formatted numbers from your Java app, I'd write it as text and make that same "service" read the text (2)
    This is the kind of thing XML is for.

  • Need Help with data type conversion

    Hello People,
    I am new to java, i need some help with data type conversion:
    I have variable(string) storing IP Address
    IPAddr="10.10.103.10"
    I have to call a library function which passes IP Address and does something and returns me a value.
    The problem I have is that external function call in this library excepts IP Address in form of a byte array.
    Here is the syntax for the function I am calling through my program
    int createDevice (byte[] ipAddress).
    now my problem is I don't know how to convert the string  IPAddr variable into a byte[] ipAddress to pass it through method.

    Class InetAddress has a method
    byte[]      getAddress() You can create an instance using the static method getByName() providing the IP address string as argument.

  • External SOAP client Accessing Webservice using built in Java Data type

    We have built a webservice and deployed it on WLS. We accessed this from a swing
    client it works fine.The webservice methods uses non-built in JAVA data types
    as parameters.These are Value Objects and the JAVA Serializer and Deserializer
    classes are generated using Ant task itself.The client coding uses Value objects
    given by the Client_jar (generated using <Clientgen> ant task) to pass to the
    webservice. We dont want to go by this way.Is there anyway were in we can pass
    parameters to the method which expects non-built in java datatypes?
    Why i am asking this is, i want to know how an external client (.Net client )
    will be able to exceute my webservice (i.e., passing the required Object which
    the method is expecting)?

    Hi Anish,
    Well first off, your web service doesn't send or receive "objects". It only sends
    and recieves XML, which is in turn converted to/from Java objects at invocation
    time. Second, a .NET (or Perl, or Python, or C++) client will be able to call
    your web service, because the wsdl.exe tool (for .NET) will generate "programming
    language specific" objects from the <types><schema> elements, in the WSDL of your
    web service :-) The wsdl.exe tool will create C# objects from the WSDL, that will
    convert XML to/from C# when your web service is called. That's the beauty of XML
    schema - it's a "universal typing system", so it's not tied to a particular programming
    language. The only issue is whether or not the web services platform vendor's
    XML Schema/WSDL processor, can successfully process the WSDL. Some vendors have
    more complete implementations of the WSDL and XML Schema specs than others, so
    expect varying success here. The one in WLS 7.0 is pretty good, so you shouldn't
    have too many problems consuming WSDL generated by .NET tools (or any other tool
    for that matter).
    Regards,
    Mike Wooten
    "Anish" <[email protected]> wrote:
    >
    We have built a webservice and deployed it on WLS. We accessed this from
    a swing
    client it works fine.The webservice methods uses non-built in JAVA data
    types
    as parameters.These are Value Objects and the JAVA Serializer and Deserializer
    classes are generated using Ant task itself.The client coding uses Value
    objects
    given by the Client_jar (generated using <Clientgen> ant task) to pass
    to the
    webservice. We dont want to go by this way.Is there anyway were in we
    can pass
    parameters to the method which expects non-built in java datatypes?
    Why i am asking this is, i want to know how an external client (.Net
    client )
    will be able to exceute my webservice (i.e., passing the required Object
    which
    the method is expecting)?

  • [SOLVED] Value too large for defined data type in Geany over Samba

    Some months ago Geany started to output an error whith every attempt to open a file mounted in smbfs/cifs.
    The error was:
    Value too large for defined data type
    Now the error is solved thanks to a french user, Pierre, on Ubuntu's Launchpad:
    https://bugs.launchpad.net/ubuntu/+bug/ … comments/5
    The solution is to add this options to your smbfs/cifs mount options (in /etc/fstab for example):
    ,nounix,noserverino
    It works on Arch Linux up-to-date (2009-12-02)
    I've writed it on the ArchWiki too: http://wiki.archlinux.org/index.php/Sam … leshooting

    An update on the original bug. This is the direct link to launchpad bug 455122:
    https://bugs.launchpad.net/ubuntu/+sour … bug/455122

  • Data type conversion JCO To ABAP( Double to DEC)

    Hi,
      I want to update a field having data type as DEC with length 11 in APO system using JCO.Whatever i give as input is not getting reflected in APO system. Instead i get some different value.
    It seems that there is some data type conversion for that field..
    Thanks
    Archana

    if(tableName.equals("BAPI10001LOCPRDVERS2"))
                                                           table.appendRow();
                                                           //System.out.println("getting inside table "+tableName);
                                                           table.setValue("SOP112","PRODUCT");
                                                           table.setValue("SCMTEST111","LOCATION");
                                                           table.setValue("1001","LOCTYPE");
                                                           table.setValue("SCMTEST111","LOCATION_INT");
                                                           table.setValue("000","PLANNING_VERSION");
                                                           table.setValue("5000","SAFETY_DAYS_SUPPLY");//this is the field having problem
                                                           table.setValue("5","SAFETY_STOCK");
                                                           table.setValue(" ","SAFTY_STOCK_CALC_METHOD");
                                                           table.setValue("5.00","OPENING_PERIOD");
                                                           table.setValue("15","FORECAST_HORIZON");
                                                           table.setValue(("20000"),"VMI_PROM_LEAD_TIME");
                                                           table.setValue("0","MINIMUM_LOT_SIZE");
                                                           table.setValue(bd1,"TARGET_DAYS_SUPPLY");

  • A new version of the data type is present than one required

    Hi  Experts,
    I am getting a short dump saying "A new version of the data type is present than one required".
    The data type in my case is the Transfer structure for 2LIS_02_SCL. I am getting this short dump whenever i try to change the transfer rules.
    I tried activating and deactivating the transfer and update rules but to no avail. Kindly advice.
    Thanks in advance.

    SAP Note 1157796 resolved the issue.

  • LOCID is not defiend for Order data type ORDR

    Dear All,
    I am trying to load data in to Order forecast details in Dynamic
    replenishment of SNC in the WEB UI, after entering the Product and
    Customer location, when I clicked on GO system is giving the below
    error.
    Time series error in class /SCF/CL_ICHDM_DEMANDMN_DATAAXS
    method /SCF/IF_ICHDMAXS_2_CNTL~SELECT
    Access error for time series type DFC01, key figure CORDEROR, ODM
    message: Parameter LOCID is not define for order data type ORDR
    Could you please help me out what to do in this case.
    I have re activated the following components mentioned, still system is
    giving the above problem.
    Activate Order Component
    Activate Order Data Type
    Activate Order Data Area
    and
    Activate Time Series Data Type
    Activate Time Series Data Area
    Thanks and Regards,
    T.Muthyalappa

    Hi,
    Make sure you have proper authorization.(sometime system does not display the error but user don't have authorization to create/update/modify table entries to be on safer side assign SAP_ALL profile to your ID if it is allowed as per your company security process).
    I think issue is with InfoObject 9ALOCID is not activated properly.
    You need activate  InfoObject 9ALOCID as mention i below step2 but it is better you follow below steps.
    1) Then force generate ODM.
    2)Go to transaction code:/N/SCA/TSDM09 enter time series DFC01 and select  Radio button Activate Planning object Structure.
    Regards,
    Nikhil.

  • HT201240 This process does not appear to work for me.  I'm running 10.8.3.  I created a new user for a guest staying with me.  They have gone now and I am attempting to either change the password or delete the user.  It won't allow me to choose the user I

    This process does not appear to work for me.  I'm running 10.8.3.  I created a new user for a guest staying with me.  They have gone now and I am attempting to either change the password or delete the user.  It won't allow me to choose the user I created.  I am logged in as myself and it states that I am an "Admin".  The user I'm attempting to change is listed as a "standard" user and there is a white checkmark inside an orange circular background on the user pic in the list of users. 
    Can someone help me?  I am having a hard time believing that OSx will allow me to create users and allow them use of my computer and it's drives, yet it will not allow me to change the password so I can monitor what they might have been doing while logged on?  What if this were my child?  This guest left under sketchy circumstances, and I'd really like to be able to ensure they were not using my computer to do illegal things or to have illegal communications.
    Any help would be appreciated.  (It's odd that it was so simple to "create" a user and set a password for them.......but it's complicated or a little known process to reverse.
    Thanks.

    Here are two screen shots to show you what I am seeing.  The first screen shot shows it allowing me to select (highlighted in blue) my admin user (which is what I am locced in as).  The second screen shot shows it allowing me to select the "Guest" user (highlighted in blue).  However when I click on the user "Orion" nothing happens.  It will not change to highlight that user.

  • How do I add another Iphone to my laptop?? I have creadted a new user for the other Iphone however it wont let me sync to the new user??? HELP

    How do I add another Iphone to my laptop?? I have creadted a new user for the other Iphone however it wont let me sync to the new user??? PLEASE HELP

    Never mind, disregard.  I went in and reset my password to my AirPort Express, and for some reason, it then went through, and is all working and good.

  • The priority of different data type conversion

    Hi All,
    I want to know the priority of data type conversion rule. if in an expression, I have several kind of data type( I, P, F,N..).
    Then finaly, all the data object will convert to which data type?
    I don't know the priority of data conversion.
    E.g.   data a type i. data b type p. data c type f.
             a = b + c.
    or    data d type p, data e type f.
          if ( d > f ).
    Then who will convert to who's type?
    Thanks and Regards.
    Aaron

    For expressions, the right term in SAP is "calculation type", it's explained here : [abap help - determining the calculation type|http://help.sap.com/abapdocu_70/en/ABENARITH_TYPE.htm]. SAP takes the "biggest" type of all variables in the expression. It can be I, P or F (smallest is I, biggest is F).
    Conditions are handled differently, just using data type conversion (see link given above by Abhishek), SAP converts from smallest to biggest type (in your case, it converts P to F and compares the two F variables).

  • Microsoft OLE DB Provider for Oracle: Data type is not supported.

    I got the error:
    Microsoft OLE DB Provider for Oracle: Data type is not supported.
    Shortly after upgrading from Oracle 8 to Oracle 9. I was advised to download more up to date oracle drivers, but I was wondering if there was a way to tell what version of the 'OLE DB Provider for Oracle' is already at. Is there a command I can use via SQL Plus or something?

    I have found Microsoft ODBC for Oracle to be more stable than the Microsoft OLEDB for Oracle driver. I have also found both Microsoft ODBC and OLEDB drivers to be more stable than the drivers from Oracle.
    You could always get the latest MDAC (Microsoft Data Access Components) from Microsoft's MSDN Download site and then get the ODAC (Oracle Data Access Components) from Oracle's OTN Download site. ODAC requires MDAC. And ODAC has the latest drivers.
    I suppose it would help to have the latest patches for your Oracle client software too. Maybe Oracle MetaLink would have these?
    It may even help to have the latest service pack for Visual Studio 6 (Visual C++ 6 and Visual Basic 6) too.

Maybe you are looking for

  • 754 Ultra MS-6561 Windows crash and now sometimes doesn't POST

    Bought a new MSI motherboard and installed everything that's in my signature.  Everything is used except for the memory and the mobo.  The computer was running fine for a few weeks. No problems. Only recent installation is an old game: Independence W

  • Throwing error from backing bean on button click?

    Hi Everyone, i have two lovs out of 2 lovs user has to select atleast one lov value and click on find button. On clicking on find button im getting lov values if atleast one is not selected i need to throw one error message. How can i throw error mes

  • Multithreaded application with labview IMAQ & WinXP on Dual Core Processor

    Hi all, I am working on a multi-threaded vision application on a PC with the latest Core 2 Duo processor.  I have image data coming over two TCP sockets, and image processing using the IMAQ Vision libraries. I have managed to parallelize the image pr

  • Need i install the XI add-in for SAP Web AS 6.20

    I want to connect a 4.71(Web AS 6.20) as a business system to a nw2004s system. The scenario is JAVA<=>XI<=>RFC(Web AS 6.20) Do i have to install the XI add-in for SAP Web AS 6.20? Regards Ming

  • Rule: Auto-reply

    A rule I've set up works just fine EXCEPT 1) There is no trace of the auto reply in my SENT box. How do I obtain evidence the rule fired correctly if there's nothing in my SENT folder? (or am I missing something) 2) When someone has an autoreply of t