Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Java Data Type

  • 10-06-2003 01:28PM
    #1
    Closed Accounts Posts: 536 ✭✭✭


    Hi I need to store an 8 byte digit in a Java Data Type.
    Can someone tell me what type will do this?

    a long is only 4 bytes yes?


Comments

  • Registered Users, Registered Users 2 Posts: 1,931 ✭✭✭Zab


    No, a long is eight bytes in Java.

    Zab.


  • Registered Users, Registered Users 2 Posts: 1,186 ✭✭✭davej


    A long is 64 bits in size.
    Also remember that all numeric types are signed.

    You may want to look at BigInteger or BigDecimal if you're looking for arbitrary precision.

    davej


  • Closed Accounts Posts: 536 ✭✭✭flyz


    thanks!


  • Registered Users, Registered Users 2 Posts: 1,931 ✭✭✭Zab


    Actually, a char is an unsigned 16-bit number, which can be very handy at times.

    Unsigned variables would probably be close to the top of my Java wishlist.


  • Registered Users, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    Originally posted by Zab
    Actually, a char is an unsigned 16-bit number, which can be very handy at times.

    Unsigned variables would probably be close to the top of my Java wishlist.

    Well, as you no doubt know, you can unsign them using the >>> (or is it <<<) operator.

    An unsigned kweyword would be nice tho :(


  • Advertisement
Advertisement