Simple Java Question -- Please have a look.

Discussion in 'Programming' started by misery89, Sep 12, 2007.

  1. #1
    Hey everyone, I'm pretty new to the Java code, and am using DrJava right now, and have used JCreator in the past.

    My question is, how do I output the numbers, say "05" from: 10599

    I was thinking something along the lines of
    output = 10599%1000;

    but that would only provide me with the "5", yet I want the zero (0) to be included.

    I'm sure it's quite simple, does anybody know?
     
    misery89, Sep 12, 2007 IP
  2. comboy

    comboy Well-Known Member

    Messages:
    328
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    103
    #2
    Covert number to string. Then you can get 2 character. Then you convert 2 character again into integer
     
    comboy, Sep 13, 2007 IP
  3. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #3
    TwistMyArm, Sep 13, 2007 IP