🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.lenguajes.java
Article #17636

Meter bytes dentro de un string en java

#17636
From: pedro.robledo
Date: Tue, 31 Oct 2000 15:54
23 lines
1669 bytes
Hola quisiera saber si alguien sabe como pasar de un string con una
cadena que tiene un numero entre 0 y 255 a un string que contenga el
correpondiente valor en ascii.
    
Actualmente hago esto, con lo que tengo en la variable sPuertoBinario
el valor en binario:
 
    String sPuerto = "129";
    int iPuerto=Integer.parseInt(sPuerto);
    Integer intPuerto = new Integer(iPuerto);
    byte bPuerto[]=new byte[1];
    bPuerto[0] = intPuerto.byteValue();
    String sPuertoBinario =new String(bPuerto);

Pero esto no funciona en particular para este caso ya que pone en
valor hexadeciman 63 es decir el caracter ascii ?. Sin embargo para
los demas funciona. Podria ser que el primer bit de la variable
bPuerto la interprete como el signo del byte y se haga un lio.

Si alguien tiene informaci�n de como manipular bytes agradeceria mucho
que me la mandara

Gracias
Technical Details
Message-ID: <39fee8e9.23299052@news.ericsson.se>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!news.tele.dk!194.213.69.151!news.algonet.se!newsfeed1.telenordia.se!algonet!newsfeed.sunet.se!news01.sunet.se!erinews.ericsson.se!erix.ericsson.se!newstoo.ericsson.se!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: 1116f3,eaf146f523a8fecf,start
X-Google-Attributes: gid1116f3,public
X-Google-ArrivalTime: 2000-10-31 06:57:50 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!news.tele.dk!194.213.69.151!news.algonet.se!newsfeed1.telenordia.se!algonet!newsfeed.sunet.se!news01.sunet.se!erinews.ericsson.se!erix.ericsson.se!newstoo.ericsson.se!not-for-mail
From: pedro.robledo@emersonenergy.com
Newsgroups: es.comp.lenguajes.java
Subject: Meter bytes dentro de un string en java
Date: Tue, 31 Oct 2000 15:54:59 GMT
Organization: Emerson
Lines: 23
Message-ID: <39fee8e9.23299052@news.ericsson.se>
Reply-To: pedro.robledo@emersonenergy.com
NNTP-Posting-Host: 164.48.103.226
X-Newsreader: Forte Free Agent 1.21/32.243