Results 1 to 2 of 2
  1. #1
    pink123 is offline Member
    Join Date
    Feb 2011
    Posts
    84
    Rep Power
    0

    Default Add zeroes to int

    Hi,

    I have an int value Extension.It should be 4 diguts long always.Even if the data via the procedure comes 45 .It should treat it as 0045.
    I cannot convert it to string as my setter method is taking int as an argument.
    I get the value of extension from database as
    extension as

    int extension=rs.getint("extension")
    obj.setExtension(int)


    This extension should add zeroes if it is not 4 digits.

    Please help I am stuck up.

    Thanks,

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    There's nothing in this question that deals with advanced Java. Since it is a multiposted question, I'm closing it and will fold the answers in the original poster's other thread. Original poster, please do not multipost questions.

Similar Threads

  1. How to add leading zeroes to int
    By pink123 in forum New To Java
    Replies: 11
    Last Post: 03-01-2011, 07:18 PM
  2. help with saving bleeding zeroes.
    By SteroidalPsycho in forum New To Java
    Replies: 6
    Last Post: 04-14-2010, 08:55 AM
  3. Shift Off Trailing Zeroes
    By nwboy74 in forum New To Java
    Replies: 5
    Last Post: 02-25-2010, 07:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •