🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #514

Re: Converting to binary representation

#514
From: Shankar Unni
Date: Tue, 07 Jun 2005 21:43
11 lines
1330 bytes
Peter Goldman wrote:

> For example: 122 value in binary is: 01111010.
> -122 value in binary is 10000110.
> Using Integer.toString method, -122 is -1111010.

To get an "unsigned byte" representation, just do "byteval & 0xff".

   byte b = ...;

   String s = Integer.toString((b & 0xff), 2);
Technical Details
Message-ID: <42a61508$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <42a4b083$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,55aa53c82de6ba30
X-Google-Attributes: gidf74b3,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 07 Jun 2005 14:43:38 -0700
From: Shankar Unni <shankarunni@netscape.net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050317 Thunderbird/1.0.2 Mnenhy/0.7
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: Converting to binary representation
References: <42a4b083$1@newsgroups.borland.com>
In-Reply-To: <42a4b083$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 68.120.146.125
Message-ID: <42a61508$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1118180616 68.120.146.125 (7 Jun 2005 14:43:36 -0700)
Lines: 11
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail