Thanks, never thought about the simple way.
-----Original Message-----
From: Joseph Ottinger [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 04, 2002 8:12 AM
To: JDJList
Subject: [jdjlist] Re: Getting digits from an integer
You could always try simple math and simple logic. Try neatoriffic stuff
like this:
public int getFirstDigit(int value) {
int rounded=(value/10)*10;
int result=value-rounded;
return result;
}
>From: Jeff Fisher <[EMAIL PROTECTED]>
>Reply-To: "JDJList" <[EMAIL PROTECTED]>
>To: "JDJList" <[EMAIL PROTECTED]>
>Subject: [jdjlist] Getting digits from an integer
>Date: Wed, 4 Sep 2002 07:59:02 -0400
>
>I need to be able to get each individual digit from an integer as an
>integer. I think I should be able to do this by using the >> operator, but
>I just can't seem to figure it out.
>
>For example if I have a number 123, I need to get 3, then the 2, then the
>1.
>It doesn't really matter the order, I just need the digits. I suppose I
>could convert it to a string and go that route, but that seems like a
>waste.
>
>Does anyone have experience with this or can point me to some
>examples/information.
>
>Thanks
>
>Jeff
>
>To change your JDJList options, please visit:
>http://www.sys-con.com/java/list.cfm
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm
To change your JDJList options, please visit: http://www.sys-con.com/java/list.cfm