How to format a BigDecimal object '11222'  into format "11,222"?

like the title describe
thx

Try this
import java.text.*;
class DecimalFormatEX
  public static void main(String args[])
    DecimalFormat df = new DecimalFormat("#,###.####");
    double nums[] = {11222,1112223,1112223.1234,1234.56789};
    for(int i = 0; i < nums.length; i++)
      System.out.println(df.format(nums));
System.exit(0);

Similar Messages

  • How to display 'List' of objects in table format

    I am trying to display bunch of records in the table format.
    I have the List of bean object populated with table datas.
    Currently the code is working fine ,if I tend to display one record.I am wondering how to display all the records.
    I know theres a 'Fieldloop'.If thats the one please explain with example.

    iterate the object list using field loop. eg. is given below
    [      <Field name='MatchTable'>
    <Display class='SimpleTable'>
    <Property name='columns'>
    <List>
    <String>title</String>
    </List>
    </Property>
    </Display>
         <FieldLoop for='name' in='userlist'>
    <Field name='username'>
    <Display class='Label'>
    <Property name='labels'>
    <ref>name</ref>
    </Property>
    </Display>
    </Field>
         <FieldLoop>
         </Field>

  • How to make a draggable object snap into place?

    I'm new to Flash (sort of - I used it a bit back in 1999-2000, but it's changed a LOT since then). I'm making an educational game for my company that involves dragging labels from a word-bank to their correct position on a diagram. I want the kids to be able to drag any one of the five labels and move them to any one of five marked positions on the diagram. I'm using Flash CS5 with Actionscript 3. I used code snippets, so that each individual label has the following code associated with it:
    movieClip_1.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    function fl_ClickToDrag(event:MouseEvent):void
    movieClip_1.startDrag();
    stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    function fl_ReleaseToDrop(event:MouseEvent):void
    movieClip_1.stopDrag();
    Is there any code that I could add in there to make the objects then snap into positions when dragged near them? Note that there are five possible positions for them to snap to. The coordinates for those are:
    X
    Y
    299.75
    235.90
    775.40
    244.65
    421.15
    447.45
    804.15
    484.85
    437.15
    599.60
    Here is a screenshot of the area of the game that this is concerning to give you an idea of what I'm talking about:
    Thanks for any help you can give me.

    It might help if I give ALL of my code for this project. Here it is:
    movieClip_1.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    function fl_ClickToDrag(event:MouseEvent):void
         movieClip_1.startDrag();
    stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    function fl_ReleaseToDrop(event:MouseEvent):void
         movieClip_1.stopDrag();
    movieClip_2.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_2);
    function fl_ClickToDrag_2(event:MouseEvent):void
         movieClip_2.startDrag();
    stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_2);
    function fl_ReleaseToDrop_2(event:MouseEvent):void
         movieClip_2.stopDrag();
    movieClip_3.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_3);
    function fl_ClickToDrag_3(event:MouseEvent):void
         movieClip_3.startDrag();
    stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_3);
    function fl_ReleaseToDrop_3(event:MouseEvent):void
         movieClip_3.stopDrag();
    movieClip_4.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_4);
    function fl_ClickToDrag_4(event:MouseEvent):void
         movieClip_4.startDrag();
    stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_4);
    function fl_ReleaseToDrop_4(event:MouseEvent):void
         movieClip_4.stopDrag();
    movieClip_5.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_5);
    function fl_ClickToDrag_5(event:MouseEvent):void
         movieClip_5.startDrag();
    stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_5);
    function fl_ReleaseToDrop_5(event:MouseEvent):void
         movieClip_5.stopDrag();
    answers_but.addEventListener(MouseEvent.CLICK, fl_ClickToPosition);
    function fl_ClickToPosition(event:MouseEvent):void
         answersflyin.x = 230.00;
         answersflyin.y = 187.50;
    hide_but.addEventListener(MouseEvent.CLICK, fl_ClickToPosition_2);
    function fl_ClickToPosition_2(event:MouseEvent):void
         answersflyin.x = 693;
         answersflyin.y = 865.8;
    clear_but.addEventListener(MouseEvent.CLICK, fl_ClickToPosition_3);
    function fl_ClickToPosition_3(event:MouseEvent):void
         movieClip_1.x = 112;
         movieClip_1.y = 246.55;
         movieClip_2.x = 112;
         movieClip_2.y = 327.85;
         movieClip_3.x = 112;
         movieClip_3.y = 415.55;
         movieClip_4.x = 112;
         movieClip_4.y = 495.5;
         movieClip_5.x = 112;
         movieClip_5.y = 578.25;
         answersflyin.x = 693;
         answersflyin.y = 865.8;
    stop();
    That all works really well, too, except that the objects don't snap into place. Other than that, I'm able to drag each of the 5 movie-clips onto the board, arrange them as I like, click one button to show correct answers, another to hide answers, and another to sweep the board clean.

  • How do I convert a shockwave object file into a mp4 or avi video?

    How do I convert a shockwave object file into a mp4 or avi video?  Do you know of any software that converts that type of file?  

    The M4V format is a video file format developed by Apple and is very close to the MP4 format. The differences are the optional Apple's DRM copyright protection, and the treatment of AC3 (Dolby Digital) audio which is not standardized for the MP4 container.
    If your M4V video is not unprotected M4V files and without AC3 audio. It may be recognized and played by other video players by changing the file extension from ".m4v" to "mp4".
    So you can try to change the file extension and check if it works. If it doesn't work, try Leawo video converter(for windows or mac) and convert m4v to mp4 format.

  • How to convert a Graphics object into a JPG image?

    I have this simple question about how to make a Graphics object into a JPG file...
    I just need the names of the classes or the packages ... I'll figure out the rest of the details...
    Thanks...

    Anyway this might come in handy
    JPEGUtils.java
    ============
    * Created on Jun 22, 2005 by @author Tom Jacobs
    package tjacobs.jpeg;
    import java.awt.Image;
    import java.awt.image.BufferedImage;
    import java.awt.image.RenderedImage;
    import java.io.BufferedInputStream;
    import java.io.BufferedOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import javax.imageio.ImageIO;
    import com.sun.image.codec.jpeg.JPEGCodec;
    import com.sun.image.codec.jpeg.JPEGEncodeParam;
    import com.sun.image.codec.jpeg.JPEGImageDecoder;
    import com.sun.image.codec.jpeg.JPEGImageEncoder;
    * Utilities for saving JPEGs and GIFs
    public class JPEGUtils {
         private JPEGUtils() {
              super();
         public static void saveJPEG(BufferedImage thumbImage, File file, double compression) throws IOException {
              BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file));
              saveJPEG(thumbImage, out, compression);
              out.flush();
              out.close();
         public static void saveJPEG(BufferedImage thumbImage, OutputStream out, double compression) throws IOException {
              JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
              JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(thumbImage);
              compression = Math.max(0, Math.min(compression, 100));
              param.setQuality((float)compression / 100.0f, false);
              encoder.setJPEGEncodeParam(param);
              encoder.encode(thumbImage);
         public static BufferedImage getJPEG(InputStream in) throws IOException {
              try {
                   JPEGImageDecoder decode = JPEGCodec.createJPEGDecoder(in);
                   BufferedImage im = decode.decodeAsBufferedImage();
                   return im;
              } finally {
                   in.close();
         public static BufferedImage getJPEG(File f) throws IOException {
              InputStream in = new BufferedInputStream(new FileInputStream(f));
              return getJPEG(in);
         public static void saveGif(RenderedImage image, File f) throws IOException {
              saveGif(image, new FileOutputStream(f));
         public static void saveGif(RenderedImage image, OutputStream out) throws IOException {
    //          Last time I checked, the J2SE 1.4.2 shipped with readers for gif, jpeg and png, but writers only for jpeg and png. If you haven't downloaded the whole JAI, and you want a writer for gif (as well as readers and writers for several other formats) download:
    //          http://java.sun.com/products/java-media/jai/downloads/download-iio.html
              ImageIO.write(image, "gif", out);
         public static void main(String[] args) {
              // TODO Auto-generated method stub
    }

  • How to get Date Format from Local Object.

    Hi All,
    I am new to Web Channel.
    I need to know Date format From date of locale.
    suppose there is a date "01/25/2010" date in date field I want to get string "mm/dd/yyyy". Actually I have to pass date format to backend when I call RFC. 
    Is there any way to get Date format from "Locale" object. I should get date format for local object
    I get local object from "UserSessionData" object but how to get Date format from it.
    I am not looking for Date value. I am looking for current local date format ("mm/dd/yyyy or dd/mm/yyyy or mon/dd/yyyy) whatever local date format.  I could not find example which show how to get date format from "Locale" object.
    Any help will be appreciated with rewards.
    Regards.
    Web Channel

    Hi,
    You can get it from "User" or "Shop" business object.
    Try to get User or Shop Business Object as shown below.
    BusinessObjectManager bom = (BusinessObjectManager) userSessionData.getBOM(BusinessObjectManager.ISACORE_BOM);
    User user = bom.getUser();
    char decimalNotation = user.getDecimalPointFormat().getGroupingSeparator();
    If you are seeing "1,234.00" then above code will return "."
    I hope this information help you to resolve your issue.
    eCommerce Developer.

  • How do I convert an audio CD format album in my library into MP3

    Here's my problem. I have two vehicles. The older vehicle only plays audio CDs and the newer vehicle will play MP3 songs. So I want to burn two CDs, an audio and an MP3.
    I imported my original CDs into iTunes and kept them in the original format, not as MP3. I then burned an audio CD and it plays correctly. Now I want to burn an MP3 CD but got an error that iTunes cannot burn the MP3 CD as the original songs are not in MP3 format. I don't know how to convert these songs to MP3 and in all the help info I have read there is nothing about this.
    I really don't want to delete these songs from the library and re-import them as MP3. that's a lot of music and time.
    Does anyone have any ideas?
    Thanks, George

    You can use iTunes to convert the songs from your CDs to another format. When you convert a song in iTunes it will be converted to the format that you have set to import your CDs in. Converting creates a second copy of the song in the format you have chosen which gives you the opportunity to either keep or delete the original. You can get details on these pages:
    How to convert a song to a different format
    How To Choose Import Settings

  • I have my photos  iPhoto but my iPhoto library is empty. when clicked message reads could not be opened image capture cannot open files in the photo library format. How do I get my photos back into my library?

    I have my photos in  iPhoto but my iPhoto library is empty.When clicked message reads could not be opened image capture cannot open files in the photo library format. How do I get my photos back into my library?

    When what is clicked?
    There are 9 different versions of iPhoto and they run on 9 different versions of the Operating System. The tricks and tips for dealing with issues vary depending on the version of iPhoto and the version of the OS. So to get help you need to give as much information as you can. Include things like:
    - What version of iPhoto.
    - What version of the Operating System.
    - Details. As full a description of the problem as you can. For example, if you have a problem with exporting, then explain by describing how you are trying to export, and so on.
    - History: Is this going on long? Has anything been installed or deleted? - Are there error messages?
    - What steps have you tried already to solve the issue.
    - Anything unusual about your set up? Or how you use iPhoto?
    Anything else you can think of that might help someone understand the problem you have.

  • How to call GOS(Generic Object service) attachment ( BMP file ) into SAP

    How to call GOS(Generic Object service) attachment ( BMP file ) into SAP script
    Example: MM02 Service object there attaching the bmp file the same file i need to call script based on the material number
    Please provide the procedure and  coding.
    Thanks in advance
    Raju

    Hi,
    The following link may be useful to u.
    help.sap.com/printdocu/.../BCSRVOBS.pdf

  • How to format a text object

    Post Author: ftpaxa
    CA Forum: Other
    I use a SQL server DataBase on Windows server 2003 with service pack 2. i use Crystal Report 10 with ODBC connection. I read that the nice DLL is "Crdb_odbc.dll".I saw a VB code "How to format a text object" on this site :http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=crxiTechrefenpdf&sliceId=&dialogID=7686352&stateId=1%200%207680692--' Create a new instance of the report.Dim oReport As New CrystalReport1Private Sub Form_Load()' Declare a TextObject object.Dim oTextObject As CRAXDRT.TextObject' Declare a generic Object.Dim oObject As Object' Declare a Section object.Dim oSection As CRAXDRT.Section' This variable is set to true once the' text object is found.Dim bText As BooleanbText = False' Search for all the report objects in each section.For Each oSection In oReport.SectionsFor Each oObject In oSection.ReportObjects' Find the first text object.If oObject.Kind = crTextObject Then' Get the text object and exit the loop.Set oTextObject = oObjectbText = TrueExit ForEnd IfNext oObjectIf bText Then Exit ForNext oSection' Format the text object and change the text.With oTextObject.BackColor = vbYellow.BorderColor = vbRed.BottomLineStyle = crLSDoubleLine.CanGrow = True.CharacterSpacing = 125.CloseAtPageBreak = True.FirstLineIndent = 25.Font.Italic = True.Font.Bold = True.Font.Size = 14.HasDropShadow = True.Height = 900.HorAlignment = crLeftAlign.KeepTogether = True.Left = 200.LeftIndent = 750.LeftLineStyle = crLSDashLine.MaxNumberOfLines = 16.RightIndent = 250.RightLineStyle = crLSDotLine.Suppress = False.SuppressIfDuplicated = True.SetText "Hello World".TextColor = vbBlue.TextRotationAngle = crRotate0.Top = 25.TopLineStyle = crLSSingleLine.Width = 3000End With' Set the report source of the viewer and view the report.CRViewer1.ReportSource = oReportCRViewer1.ViewReportEnd SubSo, i would like to do the same thingswith winbatch language. I tried this code :;Get CrystalRuntime Application Object HandleobjCra = ObjectCreate("CrystalRuntime.Application");Logs on to on or more SQL servers or ODBC data sources.objCra.LogOnServer("Crdb_odbc.dll","Magic","xxx","xx","zzzz") ; ("DLL file", "Server", "dbname", "username", "password"); open the saved reportobjReport = objCra.OpenReport("C:\Download\Perso\Programmation\Winbatch\Crystal Report\Final\rapport exploitation - abend.rpt")objReport.DiscardSavedData()TxtObj = objReport.Sections("PHb").ReportObjects("Text11")txtObj.Text = "testing" ; *** Error on this line : 1266: Ole:Bad Param Count;Export htmlPathHTML = strcat("C:\Download\Perso\Programmation\Winbatch\Crystal Report\Final\Resultat\rapport exploitation - abend.htm")hfile = PathHTMLcre = crr.ExportOptionscre.DestinationType = 1 ; diskfilecre.FormatType = 32 ; 24 = (HTML 3.2 standard), 31 = (PDF), 32 = (HTML4.0) cre.HTMLFileName = hfilecrr.Export(BOOL:@false)objectclose(cre)objectclose(objReport)objectclose(objCra)exit--
    Everythings work good except this linetxtObj.Text = "testing" I receive this error :1266: Ole:Bad Param CountI may be don't have the nice recipe. If you have a solution, it is welcome.

    Post Author: KAM
    CA Forum: Other
    Try using SetText.  Thanks.

  • How to I import Apple 'Pages' text into InDesign while keeping the formatting?

    How to I import Apple 'Pages' text into InDesign while keeping the formatting?

    I have imported the rtf file, but it shows up as only one line with a grey line after it, even though there are multiple lines

  • How do I copy a picture in PDF Format into Picasa

    How do I copy a picture in PDF Format into Picasa

    You can take a snapshot of the picture, which will put it on the clipboard, but I do not know how you will get it into Picassa without another program that can save in a graphics format. What OS are you using? Perhaps it offers a basic graphics program.

  • How to get customer-specific objects into PCUI ?

    Hello,
    we want to get an Z-table as tab page of the business partner-application into PCUI. It should 'only' be possible to create new entries - today there is no need to modify or delete records.
    Does there exist something like a "cookbook" on this task or has anyone of you experience how to get customer-specific objects (without using EEWB) into PCUI ?
    Thanks in advance
    Martin

    Option 1:
    If you are good in ABAP.
    You can add new tab in which create a new Field group. Assign it to a model access clas in which handle the table update.You can get the details in PCUI cookbook itsel.
    Option 2:
    If you are good at java
    Develop an FM to update the table.
    Call the FM from webdynpro
    Include this webdynpro as HTML viewer in PCUI.
    Regards,
    Abdul Raheem S

  • How do I convert an Object into an Array?

    If I have an instance of type object that I know is really a DataGrid row that was cast into an object when passed to a function, how can I cast that Object to an array, such that each index of this array would correspond to the information in a given column of the row?

    @Sathyamoorthi
    Can you please explain what this function does? Essentially, what should be contained in the String?
    I printed out the string and it seems like I am getting a random row in the Object, as opposed to first or last. Why is that?
    UPDATE: I printed out the value of dataGrid0.columns[5].dataField but it just turned out to be the id of the column.

  • I have used the resume tablet and put my resume into format but when emailing it, it will not open on windows. How can I change the format to where they will be able to open and view it?

    I have used the resume tablet and put my resume into format but when emailing it, it will not open on windows. How can I change the format to where they will be able to open and view it?

    I guess you mean one of the resume templates.
    What "format" have you saved your finished resume in?
    The only formats a Windows user will be able to open are .doc (Word), .pdf and rtf. The 1st 2 are usually the best.
    There is no Windows version of Pages.
    Peter

Maybe you are looking for