Article View: borland.public.jbuilder.java.language
Article #570Re: Signed to unsigned conversion
From: Jeroen Wenting
Date: Tue, 08 Mar 2005 13:20
Date: Tue, 08 Mar 2005 13:20
17 lines
1342 bytes
1342 bytes
"Rick" <r.nieuwlaat@planet.nl> wrote: >Hi, > >How to convert a signed value to unsigned? In my case I get a string as >input. This string contains a number (signed int16) which needs to be >converted to a unsigned int16 value. > >Greetings, >Rick > > where s is the String: int i = Math.abs(Integer.parseInt(s)); You may want to add some errorchecking to ascertain the string can indeed be parsed to an int.
Technical Details
Message-ID:
<422da688$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<422cfe4e$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,e1a6e22231ca0cdb X-Google-Attributes: gidf74b3,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Jeroen Wenting" <jwenting@hotmail.com> Sender: "Jeroen Wenting" <jwenting@hotmail.com> Reply-To: "Jeroen Wenting" <jwenting@hotmail.com> Subject: Re: Signed to unsigned conversion Newsgroups: borland.public.jbuilder.java.language X-User-Info: 195.242.96.116 X-Forwarded-For: 192.168.1.144 References: <422cfe4e$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <422da688$1@newsgroups.borland.com> Date: 8 Mar 2005 05:20:08 -0800 X-Trace: newsgroups.borland.com 1110288008 207.105.83.66 (8 Mar 2005 05:20:08 -0800) Lines: 17 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail