64bit unsigned int - j????

I have a 64bit unsigned int in a datastructure generated by a native method.
What would be the best java type to cast it to, before returning the value?
Thanks,
Than

BigInteger is the only java "datatype" that can handle this if you need to access the unsigned value within your Java code. None of the primitive datatypes will work as they are all signed.
The other alternative is to split the integer into 2 4 byte words and store them both in jlongs

Similar Messages

  • My Firefox crashes every time I open it and none of the steps in the database solve the problem. My crash signature is PaintFrame(nsIRenderingContext*, nsIFrame*, nsRegion const&, unsigned int, unsigned int)

    I tried opening it in safe mode and none of the other help tips in the database on firefox crashes when I open it apply to me. I also ran a couple of virus programs to check for any infections and found nothing. I had been having issues with java previous to firefox beginning to crash. So I attempted to uninstall java from my computer but it did not help.
    My crash signature is PaintFrame(nsIRenderingContext*, nsIFrame*, nsRegion const&, unsigned int, unsigned int) and a search of this term on Mozilla Support pulled up no results.
    I'm not terribly knowledgeable with programming so any suggestions would help!

    I read online about a "clean reinstall" of firefox which seems to have worked! They should include direction on this on their page: https://support.mozilla.com/en-US/kb/Firefox+crashes+when+you+open+it

  • Oracle proc Pro*C, g++/c++ compile error due to static const unsigned int sqlctx

    I'm using Oracle 8.1.6 for Linux, and 7.3.4 on HP-UX. Compiler is gcc/g++ 2.95.2
    In working with the Oracle precompiler on both HPUX and Linux, I've found a problem with the way that the Linux precompiler generates the sqlctx variable.
    On linux, the following is generated when you run the precompiler:
    static const unsigned int sqlctx = 1;
    However, on HPUX, this is the corresponding code:
    static unsigned long sqlctx = 10673468;
    When you compile the Linux version with g++/c++ or aCC, you get fatal errors of this nature:
    SQLSubsystem.cpp:562: passing `const unsigned int *' as argument 2 of `sqlcxt(void **, unsigned int *, sqlexd *, const sqlcxp *)' discards qualifiers
    Is there a way to force the output of proc to leave off the const?
    If you view the binary file proc, you can find the static unsigned int string listed. So I think it may be an option. However, I can't seem to turn it on.
    Thanks-
    Matt Wright

    As for sqlctx:
    sqlctx is a module identifier variable. i.e. if your project consists of multiple modules, each sqlctx should have different value.
    I have seen this error only on Linux Pro*C starting of 8.1.5 version (have not tested 8.0.5 nor 8.1.6).
    Anyway, I really can not understand why this error is not patched already.
    As for constness:
    I can not tell if there is an option which would solve such issue. I can only advise not to use -Werror option of gcc. It generates about 4-5 warnings per module, but it works ;-))

  • No warning when assigning to an unsigned char from unsigned int

    Is this an error in VC++, or am I missing something?  The following code should give two warnings for assigning to a smaller type, but only gives one: (compiled as 32 bit)
    unsigned
    char c;
    unsigned
    int i = 24;
    // 32 bit unsigned integer
    unsigned
    long L = 25;
    // Also a 32 bit unsigned integer
    c = L; // Warning C4244
    c = i; // no warning
    This happens in Visual Studios 2005, 2010, 2012, 2013 and 2015, at least.

    Is this an error in VC++, or am I missing something?  The following code should give two warnings for assigning to a smaller type, but only gives one: (compiled as 32 bit)
    unsigned
    char c;
    unsigned
    int i = 24;
    // 32 bit unsigned integer
    c = i; // no warning
    This happens in Visual Studios 2005, 2010, 2012, 2013 and 2015, at least.
    Have you tried it with Warning Level 4?
    In VC++ 2008 Express and W4 I get:
    Warning 2 warning C4244: '=' : conversion from 'unsigned int' to 'unsigned char', possible loss of data
    - Wayne

  • Wrtie unsigned char and unsigned int into a binary file

    Hi, I need write some data into some specific file format (.ov2) for other applications to read.
    Here is the requirement of the data:
    First byte: An unsigned char value, always "2" means simple POI entry
    Next 4 byte: An unsigned int value,
    Next 4 byte: A signed integer value.
    Next 4 byte: A signed integer value
    then next : A zero-terminated Ascii string
    Here is my code:
                       String name = "name";
                       byte type = 2;
                     int size = name.length() + 13 +1; //1+4+4+4 and there is a 0 at last
                     int a = 1;
                     int b =2;
                     ds.writeByte(type); //1 byte, need save it as unsigned char
                         ds.writeInt(size); //4 //need to be an unsignged int
                         ds.writeInt(ilont); //4 //signed int
                         ds.writeInt(ilatt); //4 //signed int
                         //write zero-terminated ascii string
                         for(int n=0; n<name.length(); n++){
                              ds.writeByte(name.charAt(n));
                         ds.writeByte(0);                    This code could not get the correct result and I think I must do some sign to unsign conversion, but I don't know how to do it. Any help?
    Thanks for you attention.

    You don't have to do anything special at all. What's in a int or a byte is what you, as a programmer, say it is. Java treats int's as signed but, in fact, with 2's complement arithmatic most operations are exactly the same. Load and store, add and subtract - it makes no difference whether a variable is signed or unsigned. It's only when you convert the number, for example to a wider type or to a string representation that you need to know the difference.
    When you read an unsigned byte and you want to widen it to an integer you have to clip the top bytes of the integer e.g.
    int len = input.get() & 0xff;This is because, since java sees a byte as signed it will extend the sign bit into the top bytes of the int. "& 0xff" forces them to zero.
    Writing it, you don't have to do anything special at all - it will autmatically get clipped. The above is probably the only concesion you'll ever need to make to unsigned binary. (You'd need to do the same thing from unsigned int to long, but this almost never happens).
    When I read ov2 files I used a mapped byte buffer, because it allows you to set either big-endian or little-endian and I wasn't sure which ov2 files used. (Sorry, I've forgotten).

  • Help with unsigned ints and how to store and retrieve data in them

    Hi all
    I have a problem where some data is being stored in an unsigned int
    i dont really know much about them and am unsure on how to go about using the data.
    The data being stored in them is row and column information in an excel spreadsheet.
    The method is passed through 2 ints (column, row) and then a unsigned int is created out of these two values
    the column is 8 bits and shift to the left hand byte (column & 0xFF <<24)
    the row is 16 bits shifted to the right of the column (row & 0XFFFF <<8)
    so if the column and row were 1,1 then the unsigned int would be
    16777472
    and for 1,2 then it would be 16777728
    (i dont actually know how these numbers are formed, it would be great if someone can explain this too :) )
    anyway now i have those unsigned int numbers does anyone know how i would go about taking that unsigned int and getting my int back from it
    so take 16777728 and extracting column 1, row 2
    any help would be appreciated

    its not a 3rd party product, its been written by
    another peep who is on holiday for 2 weeks so im
    trying to sort something out but dont really
    understand unsigned ints and stuff :(This is what is called a "third party product". It's not written by Sun, and it's not written by you.

  • Unsigned int - problem translating c++ function to java

    OK so here's the deal:
    I'm writing a client for a internet comunicator in java (J2ME to be precise). Unfortunately i have specs for this comunicator's protocol for c++ programing. The first problem I ran to is: I have to calculate a hash for a password so it doesn't go plain text on the network. The function in c++ that does this is:
    int getPasswordHash(char *password, int seed){
        unsigned int x=0, y=0, z=0;
        char *pwd = password;
        y = seed;
        for (x = 0; *password; password++) {
         x = (x & 0xffffff00) | *password;
         y ^= x;
         y += x;
         x <<= 8;
         y ^= x;
         x <<= 8;
         y -= x;
         x <<= 8;
         y ^= x;
         z = y & 0x1f;
         y = (y << z) | (y >> (32 - z));
        cout << "Hash for \"" << pwd << "\" with seed \"" << seed << "\": " << y << "\n";
        return y;
    }My translation to java goes:
    public int getPasswordHash(String password, int seed){
        long x = 0, y = 0, z = 0;
        int tmp = 0;
        String pwd = password;
        y = seed;
        for (x = 0; x < password.length(); x++){
            tmp = (int)x;
            x = x | password.charAt(tmp);
            y ^= x;
            y = uintadd(y, x);
            x <<= 8;
            y ^= x;
            x <<= 8;
            y = uintsubst(y, x);
            x <<= 8;
            y ^= x;
            z = y & 0x1f;
            y = (y << z) | (y >> (32 - z));
            x = tmp;
        System.out.println("Hash for \""+ pwd + "\" with seed \"" + seed + "\": " + y);
        return (int)y;
    public long uintadd (long x, long y){
        long xL = x & 0xffffffffL;
        long yL = y & 0xffffffffL;
        long sumL = xL + yL;
        long sum = (sumL & 0xffffffffL);
        return sum;
    public long uintsubst (long x, long y){
        long xL = x & 0xffffffffL;
        long yL = y & 0xffffffffL;
        long sumL = xL - yL;
        long sum = (sumL & 0xffffffffL);
        return sum;
    }So I use the uintadd and uintsubst to add and substract values that should be unsigned int. Every operation works exactly like in c++ (I've checked) until this point:y = (y << z) | (y >> (32 - z));and to be exact (y << z) This doesn't turn out like in c++ so the whole function doesn't return the right vaule. I know it's because doing a bit operation on a unsigned int in c++ is different in than in java because unsigned variables have totally different bit values than signed ones. The question is: how to work this out. I managed to do aritmetic operations working but I have no idea how to deal with this. Any help would be great.

    I'm by no means the expert with this, but I'm going
    to guess that this would work...
    y = ((y << z) & 0xffffffffL) | (y >> (32 - z));
    thus... to zero out the right shifted 1's before the
    orWOW WOW WOW it totaly works thanks alot bsampieri !!

  • How do i Send 8 and 16 bit unsign int througth the serial port

    8 and 16 unsigned int througth the serial port

    And How may pass 16 bit to my dac (datasheet attached) which desires serial data from 4 line (fig.8a pag.12) using parallel port (TTL compatible required)?
    Any advice will be appreciated.
    Paolo
    Attachments:
    dac714.pdf ‏132 KB

  • Keeps crashing when i open. signature is : PL_DHashTableOperate | GCGraphBuilder::NoteRoot(unsigned int, void*, nsCycleCollectionParticipant*)

    it crashes when i oen regularly and in safe mode.
    problem happened after computer was returned from apple, refurbished (i.e., the hard drive was erased!)

    Seems to be handled in this bug report:
    [https://bugzilla.mozilla.org/show_bug.cgi?id=597972 Bug 597972] – crash on startup [@ PL_DHashTableOperate | GCGraphBuilder::NoteRoot(unsigned int, void*, nsCycleCollectionParticipant*) ]
    (please do not comment in bug reports)

  • Converting from unsigned int / short to byte[]

    Can anybody help me, I am trying to convert from:
    - unsigned int to byte[]
    - unsigned short to byte[]
    I will appreciate your help lots. thanks.

    @Op.
    This code converts an integer to a byte[], but you have to consider the byte order:
            int value = 0x12345678;
            byte[] result = new byte[4];
            for (int i=3; i>=0; i--) {
                result[i] = (byte)(value & 0xff);
                value = value >> 8;
            }This is another option:
            int dummy = 7;
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            os.write(dummy);
            byte[] bytes = os.toByteArray();Kaj

  • Firefox crashes almost constantly. My crash signature is CD3DBase::DrawPrimitive(_D3DPRIMITIVETYPE, unsigned int, unsigned int)

    <pre><nowiki>Firefox 4.0.1 Crash Report [@ CD3DBase::DrawPrimitive(_D3DPRIMITIVETYPE, unsigned int, unsigned int) ]
    Search Mozilla Support for Help
    ID: df5fa277-41b2-46b3-9f02-2bf3f2110513
    Signature: CD3DBase::DrawPrimitive(_D3DPRIMITIVETYPE, unsigned int, unsigned int)
    Details
    Modules
    Raw Dump
    Extensions
    Comments
    Correlations
    Signature CD3DBase::DrawPrimitive(_D3DPRIMITIVETYPE, unsigned int, unsigned int)
    UUID df5fa277-41b2-46b3-9f02-2bf3f2110513
    Uptime 15.2 minutes
    Last Crash 915 seconds (15.2 minutes) before submission
    Install Age 527000 seconds (6.1 days) since version was first installed.
    Install Time 2011-05-07 23:27:42
    Product Firefox
    Version 4.0.1
    Build ID 20110413222027
    Release Channel release
    Branch 2.0
    OS Windows NT
    OS Version 5.1.2600 Service Pack 3
    CPU x86
    CPU Info GenuineIntel family 15 model 2 stepping 9
    Crash Reason EXCEPTION_ACCESS_VIOLATION_WRITE
    Crash Address 0x1
    User Comments
    App Notes AdapterVendorID: 10de, AdapterDeviceID: 02e0, AdapterDriverVersion: 6.14.12.7061
    D3D10 Layers? D3D10 Layers-
    D3D9 Layers? D3D9 Layers+
    Processor Notes
    EMCheckCompatibility True
    Winsock LSP MSAFD Tcpip [TCP/IP] : 2 : 1 : MSAFD Tcpip [UDP/IP] : 2 : 2 : MSAFD Tcpip [RAW/IP] : 2 : 3 : RSVP UDP Service Provider : 6 : 2 : RSVP TCP Service Provider : 6 : 1 : MSAFD NetBIOS [\Device\NetBT_Tcpip_{D18F9393-8A72-4F22-AA8A-FEF9786EC28E}] SEQPACKET 4 : 2 : 5 : MSAFD NetBIOS [\Device\NetBT_Tcpip_{D18F9393-8A72-4F22-AA8A-FEF9786EC28E}] DATAGRAM 4 : 2 : 2 : MSAFD NetBIOS [\Device\NetBT_Tcpip_{32E7F2E7-2ED1-4450-8C6B-8DB1B597737D}] SEQPACKET 0 : 2 : 5 : MSAFD NetBIOS [\Device\NetBT_Tcpip_{32E7F2E7-2ED1-4450-8C6B-8DB1B597737D}] DATAGRAM 0 : 2 : 2 : MSAFD NetBIOS [\Device\NetBT_Tcpip_{A01D2C7A-0D97-4183-A5B1-A2FB8C008974}] SEQPACKET 1 : 2 : 5 : MSAFD NetBIOS [\Device\NetBT_Tcpip_{A01D2C7A-0D97-4183-A5B1-A2FB8C008974}] DATAGRAM 1 : 2 : 2 : MSAFD NetBIOS [\Device\NetBT_Tcpip_{532EB614-3BEA-4AF3-99AE-989D1B273FF9}] SEQPACKET 2 : 2 : 5 : MSAFD NetBIOS [\Device\NetBT_Tcpip_{532EB614-3BEA-4AF3-99AE-989D1B273FF9}] DATAGRAM 2 : 2 : 2 : MSAFD NetBIOS [\Device\NetBT_Tcpip_{269D4DF2-D033-4CCA-99B4-0EDBAC2A1D21}] SEQPACKET 3 : 2 : 5 : MSAFD NetBIOS [\Device\NetBT_Tcpip_{269D4DF2-D033-4CCA-99B4-0EDBAC2A1D21}] DATAGRAM 3 : 2 : 2 :
    Adapter Vendor ID
    Adapter Device ID
    Bugzilla - Report this Crash
    Crashing Thread
    Frame Module Signature [Expand] Source
    0 @0x2c07502
    1 d3d9.dll CD3DBase::DrawPrimitive
    2 d3d9.dll _allshl
    3 xul.dll mozilla::layers::ImageLayerD3D9::RenderLayer gfx/layers/d3d9/ImageLayerD3D9.cpp:372
    4 xul.dll mozilla::layers::ContainerLayerD3D9::RenderLayer gfx/layers/d3d9/ContainerLayerD3D9.cpp:330</nowiki></pre>

    *https://crash-stats.mozilla.com/report/index/df5fa277-41b2-46b3-9f02-2bf3f2110513
    Try to disable hardware acceleration.
    * Tools > Options > Advanced > General > Browsing: "Use hardware acceleration when available"
    If disabling hardware acceleration works then check if there is an update available for your graphics display driver.

  • WHY NOT UNSIGNED INT

    Hi
    In java int or float or double type are signed type
    Why not unsigned

    It was a design decision not to include unsigned integral types in Java.
    Java's designers might have judged that the difficulties and complicity arising from having signed and unsigned types overweigh the benefits in Java.

  • Java newbie help (type casting, 64bit unsigned Long)

    Hi I am java newbie and need help on my project. I have a few questions. Can you put strings in a hashtable and test for their being their with the appropriate hashtable method? I want to test for equal strings, not the same object. Second question can you use all 64 bits of an unsigned long? java doesn't seem to allow this. Any packages that do?
    Thanks,
    Dave

    Try casting it to Long instead of long. Long (capital L) is an Object, while long (lower case l) is not. You may also check to make sure the value isn't null. I would have thought that autoboxing would have worked here unless the value was null. But I am no expert on autoboxing.
    Edit >> Checking for null ain't a bad idea but has nothing to do with the problem - this is a compile time problem. Sorry.
    Also>> This code should work:
    long cTime=(Long)session.getAttribute("creationtime");Edited by: stevejluke on Jul 1, 2008 11:00 AM

  • Unsigned int to integer conversion

    Hi,
    I have an unsigned integer column in my database table. If I try to retreive the value of the column using resultset.getInt() I'm getting "Numeric value overflow" error as it exceeds the INT_MAX value.
    For eg., if the column value : 4294967295, the expected value from resultset.getInt() is -1 or Numeric Value Overflow error ?
    Is it valid to retrieve the value using getInt() or should I use getLong()?.
    Kindly Clarify.
    Thanks,
    Radhika.

    use getLong

  • Import einer dll mit unbekanntem Datentyp UWORD und UBYTE -- unsigned int 8/32

    Hallo,
    ich möchte eine dll importieren (LV 2012 SP1), in der die Datentypen UWORD und UBYTE verwendet werden.
    Resultat sind vis mit Clustern aus unbekannten Datentypen am Eingang. 
    Wie kann ich (z.B. durch eine geeignete Präprozessorangabe etc.?) direkt beim Import die jeweiligen Datentypen umwandeln?
    UWORD --> UINT32
    UBYTE --> UINT8

    Bitte entschuldigen Sie meine schlechte Deutsch.  Ich bin Amerikaner.
    Sie koennen das Call Libarary Function Node betnuzen. 
    Es laesst Ihr die Parameters waehlen.  Es hat alle Datentypen.
    Wenn Sie Englisch sprechen koennen, dann lesen Sie diesen Artikel fuer mehr Informationen:  http://www.ni.com/white-paper/3009/en/
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    If someone helped you out, please select their post as the solution and/or give them Kudos!

Maybe you are looking for

  • I am a Communications student with my major in journalism and Broadcasting. Should i get a MacBook Air or a MacBook Pro?

    I am a university student and I currently use a Windows computer but I think it's time for a Mac upgrade. I'll be using it for writing lots of word documents and powerpoints, LOTS of web surfing espescially with many tabs and watching shows from my e

  • Some questions regarding ESB system.

    Hi all, I've used my ESB system for a few months now, so I thought it would be interesting to look at what's going on in my database schema created by my esb system (oraesb). This led to some questions (and raising eyebrows), I hope some of you soa-e

  • Upgrade question on older CS2 suite/Photoshop

    I recently bought a sealed Adobe CS2 Creative Suite Premium upgrade, Adobe P/N 28040331. On the outside of the package it says it will upgrade to the CS2 Suite if one is "a licensed user of Adobe Photoshop CS or an earlier version." I own licenses fo

  • Cl_gui_alv_grid

    Dear Expert, I am developing a report with cl_gui_alv_grid. After show the total data of material , use can double click on the plant to get the detail data of the material number. I set it with call screen 100 and in screen 100 I create a container

  • Problem while opening Portal

    Hi,   When i click on any link on my portal home page, the status bar showing the message, "Done but Error on page" and nothing is getting opened.The address bar showing the following URL.... "http://ps5207:50300/irj/portal?standAlone=true&InitialNod