Just a friendly suggestion:

If you're doing things at the bit level (like masking off bits), you should
use Hex notation in the code to make things clearer.

> public byte DecToByt(int Dec){return (byte)(Dec&255);}

public byte DecToByt(int dec)
{
    return (byte)(dec & 0xff);
}

TM

"Mbox" <[EMAIL PROTECTED]> wrote in message
002401bf92a3$44089180$f2aefea9@develop">news:002401bf92a3$44089180$f2aefea9@develop...
>
> Hi Paul,
> You can find your magic function therefore:
>
> public byte DecToByt(int Dec){return (byte)(Dec&255);}
>
> Best regards,
> Yones
> e-mail: [EMAIL PROTECTED]
>
> ----- Original Message -----
> From: Paul Sheridan <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, March 15, 2000 6:59 PM
> Subject: [OCF] Number Base Conversions [important]
>
>
> > Greetings all,
> > I need an answer to this ASAP so any help you could offer, or resource
you
> could direct me too would be great !  this question may be slighty
> off-topic, but nonetheless I will be indebted for any help you could offer
!
> >
> > how do I change from decimal to base 16 and assign the value to a byte ?
> specifically for getting the base 16 value of the return of
> java.lang.String.length()
> >
> > e.g. if I have
> >
> > String myString = "ABCDEF..Z";
> >
> > then length() will return 26
> > but what I want essentially what I need is:
> >
> > byte = SomeFunction(myString.length());
> >
> > where byte will have the value 0x19 in this case... so, what is the
> SomeFunction I apply to the return of String.length that will give me a
hex
> assignment to the byte ?
> >
> > Thanks in advance,
> > Paul
> >
> > PS In case you are wondering, its so as I can set the LC byte in base 16
> format.
> >
> >
> >
> > _____________________________________
> >
> > Get your free E-mail at http://www.ireland.com
> >
> >
> > ---
> > > Visit the OpenCard web site at http://www.opencard.org/ for more
> > > information on OpenCard---binaries, source code, documents.
> > > This list is being archived at
http://www.opencard.org/archive/opencard/
> >
> > ! To unsubscribe from the [EMAIL PROTECTED] mailing list send an
email
> > ! to
> > !                           [EMAIL PROTECTED]
> > ! containing the word
> > !                           unsubscribe
> > ! in the body.
> >
> >
>
>




---
> Visit the OpenCard web site at http://www.opencard.org/ for more
> information on OpenCard---binaries, source code, documents.
> This list is being archived at http://www.opencard.org/archive/opencard/

! To unsubscribe from the [EMAIL PROTECTED] mailing list send an email
! to
!                           [EMAIL PROTECTED]
! containing the word
!                           unsubscribe 
! in the body.

Reply via email to