Formatting Decimal Numbers

I would like to know how to format a Decimal number in java.....for example if i have this number 12.33423231 how can i format it to get it like this: 12.334..???
Thanks

java.text.DecimalFormat. If you are 5.0 or later, the printf() method takes formatting masks as well.
- Saish

Similar Messages

  • Problem with importing decimal numbers in Apex

    Hi,
    I have a ascii data file which I load into db tables calling a procedure in a db package.
    Executing the procedure by SQL Plus everything works fine.
    Calling the procedure by Apex button I get a "ORA-01722: invalid number; Error inserting subject" because of the decimal numbers in the data file. Taking the decimal numbers out of the file it works.
    - I tried with different formats in the data file like: 4.40 4,40 4.4 4,4: Makes no difference.
    - In Apex I tried column formatting in the report attribute: 999G999G999G999G990D00: Makes no difference, it's obviously only formatting the display.
    - Debug mode just shows there is an error..
    - The db column is of format NUMBER(10,2)
    As I mentioned, with SQL Plus it works no matter of the number format in the data file.
    Anybody has an idea where the problem might be?
    Help is greatly appreciated,
    Roger

    Hi Joel,
    Thanks for your reply. You were right, the NLS setting for the decimal separator in SQL*Plus is a , (komma) and in Application Express a . (point).
    I suspected a NLS problem that's why I tested with different formats in the data file (4.40 4,40). Shouldn't that make a difference?
    Now, to fix it: I didn't see in Apex any NLS settings, I checked in utilities and shared components. So, the way to do that is to directly write into SQL Workshop / Apex?
    ALTER SESSION SET NLS_NUMERIC_CHARACTERS=",' "
    Cheers,
    Roger

  • Conversion of a binary data stream to decimal numbers

    Hi
    I am having great difficult working out how to convert my binary data stream to decimal numbers.
    The data I am reading back is in the format of a binary string, starting with the Most Significant Bit (MSB) of the first word, then the corresponding Least Significant Bit (LSB), where a word is two bytes long. A carriage return indicates message termination.  The return message starts with ‘bin,’ followed by the number of bytes requested. No delimiters are used to separate the data, but a carriage return is appended onto the end of the data.
    bin,<first word msb><first word lsb>...<last word lsb><CR>
    e.g. bin,$ro¬z1;@*...etc
    Does anybody know of any examaple vi that can help me convert this data from binary to decimal numbers?
    Many Thanks
    Ash

    Hi Ashley,
    after getting the string you can strip the first 4 characters. After this try a typecasting to array of U16. If the numbers are not correct, you can add a swap bytes operation to the resulting array.
    Message Edited by GerdW on 09-13-2006 02:46 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    Convert.png ‏2 KB

  • 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.

  • BI Publisher Report does not display decimal numbers

    Hi,
    I have created a one page BI Publisher Report. I generally take the .xdm and .xdoz files and send it to the client which they upload on their server. The report has been coming up fine until recently there was a glitch on the Client Server. Now the report does not show a a section which has decimal numbers. I can see it perfectly on my machine. I am extremely frustrated to search for a solution and client is not very helpful in providing the information what went wrong or what was the fix on their server. Any help is greatly appreciated.
    Thanks,
    DRL

    user8824622
    If i am understanding your issue right i guess i have faced the same one while ago.
    The solution for this one is, if you are on the latest patch or update, i am on July update
    Go to
    Administration--> manage Bi Publisher under Bi Publisher --> under run time configuration --> properties --> the last option on the list which is Use 11.1.1.5 compatibility mode true --> apply
    now it should be working
    Please let me know if it worked out and mark as correct if it have solved the issue
    Thank You

  • I would like to read a text file in which the decimal numbers are using dots instead of commas. Is there a way of converting this in labVIEW, or how can I get the program to enterpret the figures in the correct way?

    The program doest enterpret my figures from the text file in the correct way since the numbers contain dots instead of commas. Is there a way to fix this in labVIEW, or do I have to change the files before reading them in the program? Thanks beforehend!

    You must go in the labview option menu, you can select 'use the local
    separator' in the front side submenu (LV6i).
    If you use the "From Exponential/Fract/Eng" vi, you are able to select this
    opton (with a boolean) without changing the labview parameters.
    (sorry for my english)
    Lange Jerome
    FRANCE
    "Nina" a ecrit dans le message news:
    [email protected]..
    > I would like to read a text file in which the decimal numbers are
    > using dots instead of commas. Is there a way of converting this in
    > labVIEW, or how can I get the program to enterpret the figures in the
    > correct way?
    >
    > The program doest enterpret my figures from the text file in the
    > correct way since the numbers contain dots instea
    d of commas. Is there
    > a way to fix this in labVIEW, or do I have to change the files before
    > reading them in the program? Thanks beforehend!

  • How to express cell format in Numbers?

    In Numbers on Mac, I want all positive numbers in cells to display in blue with comma separators and a leading + sign.  Example: the value 4135 should appear as +4,135
    I want all negative numbers in cells to display in red with comma separators and a leading - sign.  Example: the value 2167 should appear as -2,167
    I know how to create this in Excel with the custom format [Blue]+#,##0;[Red]-#,##0
    When I create a spreadsheet in Excel, then open the spreadsheet in Numbers, this cell format is not recognized by Numbers.  Does anyone know how to create this cell format in Numbers?  Thx

    Hi pomme4moi,
    You can get the "+", the "-" and the commas in the custom format menu.
    For you colors you need conditional formatting as shown by Wayne.
    quinn

  • How to delete a custom format in Numbers 3

    I am one of the poor unfortunates that has upgraded to Numbers 3 BIG mistake!!
    However does anyone know how to delete a custom format in Numbers 3?
    I'm not sure where the custom format came from in the erlier version of numbers. I guess I must have created it for something, I can't remember what.
    It now appaers that when I send a Numbers 3 document via email to an Excel format  it adds a weird custom format that turns currency into garbage. Once in Excel simply going to format cells and deleting this odd format cures the problem.
    If I could find a way of deleting it in Numbers 3, hopefully the problem will go away.
    This is far from the only problem I'm having with Numbers 3. It's begining to look like I'll have to abandon Numbers 3 having had to go to the expense of buying a new iPad because Numbers 3 documents (and presumably Pages Keynote etc) no longer work on the original iPad.

    I never promote the method the deletion unless you understand the underlying tables of planning, if you search on the forum you will see posts on the subject just like this one - Delete dimension from planning application
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Error in Number format with numbers 3.0

    Hi.
    I have just purchased Apple Numbers 3.0. It's running on a Mac Book Pro Retina on OS X Mavericks
    I can't use it at all.
    When I enter numbers in the cels it formats the numbers wrong. I'm danish, but run OS X in english with danish region settings.
    What happens is that when i for instance write 20 in B3, it autocorrects it to 0020, and then I can't calculate on it.
    If i set it to English region it works. But since I'm danish I would expect Apple to respect me using my own language.

    Report the bug to Apple with the Numbers > Feedback tool.
    Jerry

  • ICloud you have the ability to NOT format phone numbers of contacts; this ability is not available on the contacts of iPhone. If I set-up a phone number in iCloud with NO parenthesis, ex. 123- 456-7899, then this format should be available on the iPhone

    In iCloud you have the ability to NOT format phone numbers of contacts; this ability is not available on the contacts of iPhone. If I set-up a phone number in iCloud with NO parenthesis, ex. 123- 456-7899, then this format should be available on the iPhone contact.

    That is correct is doesn't. Standardized formatting of phone numbers in the iOS app is more important because it supports contact from a variety of locations (gmail, hotmail, etc.). iCloud doesn't (not directly).

  • Problem with decimal numbers..

    hi i posted the other day with a problem I had. I thought it was all sorted but I have just realised that there is another problem.
    I have the following code for an applet:
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class TextFieldExample extends Applet implements ActionListener {
    TextField textInput;
    String text = "";
    public void init() {
    textInput = new TextField (20);
    add(textInput);
    textInput.addActionListener(this);
    public void actionPerformed(ActionEvent e) {
    text = textInput.getText();
    repaint();
    public void paint(Graphics g) {
         int x = Integer.parseInt(text);
         double y = Math.abs(x);
    g.drawString("You wrote " + text,20,500);
         g.drawString("The absolute value is: " + y,20,100);
    I am trying to do the applet so when you type in an angle, it tell you the sine, cosine etc. I can get it to work with whole numbers like 1,10,300, but it won't work when i try to use decimal numbers. Can anyone help?
    Thnk you in advance!
         

    Hi,
    you are using Integer.parseInt() to convert the input, so it will only work if the text is an integer. Use Double.parseDouble() instead.
    Andre

  • Sorting xml content based on decimal numbers

    hi,
    I would like to proceed a sorting an xml content. So, when the sorting elements are numbers, I must add the dt:dt="number" attribute in the concerned tag.
    But when this number are decimal numbers, it seems that the sorting occurs only when the decimal separator is the '.', but it does not work when the decimal separator is the ','.
    So is there a solution for sorting decimal numbr with the decimal separator ',' ?
    Thanks in advance
    Bye

    Typically the best way is if you know the name of the default table that contains your document. You do the update on the default table as follows
    update yourTable  t
         set object_value = updateXML(...)
    where ref(t) = (
                     select extractValue(res,'/Resource/XMLRef')
                       from resource_view
                      where equals_path(res,'/some/path/mydocument.xml') = 1
                          )

  • Sql Loader - Decimal numbers showing in null column

    Greetings,
    My apologies if this is in the wrong forum section. It seemed to be the most logical.
    I have added new column to a control file used in a sql loader upload and I am getting unexpected results. Long story short, I copy foxpro tables from a network directory to my local pc. A foxpro exe converts these tables to .dat files. Sql loader then uploads the .dat files to matching oracle tables. I've run this program from my pc for years with no problems.
    Problem now: We added a new column to a foxpro table and to the matching oracle table. This column in FoxPro in null for now - no data at all. I then added the new column to my ctl file for this table. The program runs, sql loader does it's thing with no errors. However, in the new field in Oracle, I'm finding decimal numbers in many of the records, when all records should have null values in this field. I've checked all other columns in the oracle table and the data looks accurate. I'm not sure why I'm getting these decimal values in the new column.
    My log and bad files show no hints of any problems. The bad file is empty for this table.
    At first I thought the positioning of the new column in the fox table, .ctl file and the oracle table were not lining up correctly, but I checked and they are.
    I've double checked the FoxPro table and all records for this new column are null.
    I'm not sure what to check for next or what to test. I am hoping someone in this forum might lend a clue or has maybe seen this problem before. Below is my control file. The new column is the last one: fromweb_id. It is a number field in both FoxPro and Oracle.
    Thanks for any advise.
    JOBS table control file:
    load data
    infile 'convdata\fp_ora\JOBS.dat' "str X'08'"
    into table JOBS
    fields terminated by X'07'
    TRAILING NULLCOLS
    (SID,
    CO_NAME "replace(replace(:CO_NAME,chr(11),chr(10)),chr(15),chr(13))",
    JOB_TITLE "replace(replace(:JOB_TITLE,chr(11),chr(10)),chr(15),chr(13))",
    CREDITS,
    EARN_DATE date "mm/dd/yyyy",
    COMMENTS CHAR(2000) "replace(replace(:COMMENTS,chr(11),chr(10)),chr(15),chr(13))",
    DONT_SHOW,
    PC_SRC "replace(replace(:PC_SRC,chr(11),chr(10)),chr(15),chr(13))",
    PC_SRC_NO,
    SALARY,
    SALFOR,
    ROOM,
    BOARD,
    TIPS,
    UPD_DATE date "mm/dd/yyyy hh12:mi:ss am",
    STUKEY,
    JOBKEY,
    JO_COKEY,
    JO_CNKEY,
    JO_ZUKEY,
    EMPLID,
    CN_NAME "replace(replace(:CN_NAME,chr(11),chr(10)),chr(15),chr(13))",
    JOB_START date "mm/dd/yyyy",
    JOB_END date "mm/dd/yyyy",
    FROMWEB_ID)

    I apologize for not explaining how this was resolved. Sql Loader was working as it should.
    The problem was due to new fields being added to the FoxPro table, along with the fromweb_id column, that I was not informed about. I was asked to add a column named fromweb_id to the oracle jobs table and to the sql-loader program. I was not told that there were other columns added at the same time. In the foxpro table, the fromweb_id column was the last column added.
    The jobs.dat file contained data from all columns in the foxpro table, including all the new columns. I only added the "fromweb_id" to the control file, which is what I was asked to do. When it ran, it was getting values from one of the new columns and the values were being uploaded into the fromweb_id column in Oracle. It is that simple.
    When I had checked the FoxPro table earlier, I did not pickup on the other new columns. I was focussing in on looking for values in the fromweb_id column. When back-tracing data in the jobs.dat file, I found a value in the fromweb_id column that matched a value in a differnt column (new column) in FoxPro. That is when I realized the other new columns. I instantly knew what the problem was.
    Thanks for all the feedback. I'm sorry if this was an inconvenience to anyone. I'll try to dig a little deeper next time. Lessons learned...
    regards,

  • Why the currency format in numbers is very limited into few countries???  I think this is a must have in next update of numbers ..

    I was doing a spread sheet for a business proposal to my colleague in Philippines, was very disappointed to know that the currency format in Numbers for Mac is very limited to few countries only...

    As Badunit suggests, in Numbers 2.3 you can turn on the preference that shows the full currency list.
    Put a value in a cell and then choose Philippine Peso.  Save the document.  Open the document in Numbers 3.0 (if that is what you are working with) and you will still have access to that currency.
    You might go to Numbers > Provide Numbers Feedback to let Apple know you need the option to use more currencies in Numbers 3.
    SG

  • BO XI R2 - decimal numbers are truncated

    Hi all,
    When we create query in webitelligence the measure "item price" the decimal numbers are truncated/not shown. The right number is 23.123,55 but we get 23.123,00 ?
    Configuration:
    WIN 2003 server,
    BOE XI r2 => IIS,
    SAP int. kit XI r2
    Thank you for reply!
    Gregor

    Hi Roman,
    you can download the supported platforms list here [http://service.sap.com/bosap-support]. Just navigate to Documentation->Supported Platforms.
    The work-around with the special system user may be used if you have truncation problems on your BOBJ server after installing the integration Kit for SAP. Please keep in mind that this is a work-around when using the integration Kit for SAP and not a recommendation for every installation. As far as I know this problem will be fixed in one of the future fix packs (at least for XI 3.x).
    Regards,
    Stratos

Maybe you are looking for