Results 1 to 3 of 3

Thread: 2 integers

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2009
    Posts
    1

    2 integers

    Hey i have a quick JAVA question about integers.

    Code:
    int blaat = 12;
    
    int number = blaat + blaat;
    The result i need is 1212 but ofcourse it gives 24. How do i get the 1212 result ?

    Greetings,
    Frax

  2. #2
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: 2 integers

    You'll need to convert it to a string first, and then I guess since you want an int value, you will need to convert it back to an integer.

    Look into parseInt and toString

  3. #3
    Member
    Join Date
    May 2008
    Posts
    36

    Re: 2 integers

    java Code:
    1. int a = 12; //12
    2. int b = Integer.parseInt(Integer.toString(a) + Integer.toString(a)); //1212

Posting Permissions

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



Click Here to Expand Forum to Full Width