How to convert an int number to a byte array, and how to convert back?

Hello, everybody,
Just as the topic, if I have an int number(which should have 32-bit, or 4-byte), how can I convert it into a byte array. And also, how to convert it back.
Thank you in advance!

Alternatively you can use ByteBuffers to do this work for you
// to a Byte Array
int originalInt =...;
ByteBuffer myBuffer = ByteBuffer.allocate(4);
myBuffer.putInt( originalInt );
byte myArray[] = myBuffer.array();
// and back to an int
ByteBuffer myOtherBuffer = ByteBuffer.wrap(myArray);
int finalInt = myOtherBuffer.getInt();

Similar Messages

  • How do i convert an image object to a byte array ?

    Hi
    how do i convert an image object into a byte array
    early reply apperciated

    Oh sorry my method and the other method need to have the pixels from the Image passed to them which you get my using pixelgrabber:
    //create width and height variables from image
              int w = img.getWidth(this);
              int h = img.getHeight(this);
              //retrive picture from image
              int[] pix = new int[w * h];
              PixelGrabber pg = new PixelGrabber(img, 0, 0, w, h, pix, 0, w);
              try{ pg.grabPixels();
              } catch (InterruptedException ioe) {
                   System.err.println("Interrupted");
              if ((pg.getStatus() & ImageObserver.ABORT) != 0) {
              System.err.println("image fetch aborted or errored");
              }

  • All my excel files were converted to pdf. Why would this happen and how do i stop it from doing so?

    All my excel files were converted to pdf. Why would this happen and how do i stop it from doing so?

    shloimypt wrote:
    All my excel files were converted to pdf. Why would this happen and how do i stop it from doing so?
    Relax, they weren't converted to PDF.
    You can tell by right clicking ANY of them and choosing "Properties". You'll see there that they're STILL .xls or .xlsx files. The "association" has changed and Windows now indicates that they open with Reader, which isn't right.
    Where it says "Open With" under the General tab, you can click "Change" and re-select Excel as the default app to open thim.
    See: http://helpx.adobe.com/acrobat/kb/application-file-icons-change-acrobat.html

  • How do we decide the number of data base servers and application servers ?

    Dear Gurus,
    How do we decide the number of data base servers and application servers in BW ?
    How does this number help in data load balance and reporting needs ?
    Any hard n fast rule in the number of servers ?
    Regards
    Mohan

    Hi Mohan,
    Check the number of application server in the T-code SM66.... and also u can check the it in Sm50 on appplication server basiss./.
    From Sm37 u can see the application server Push button.. if u click on that also.. u can see the number of application servers in the system..
    Get into the individual application server and check how many Dialogue and background WP's are free,,
    If u see that the considerable number of WP are free(Waiting for task).. then u can shedule the loads..
    If most of the WP are  busy then u need to wait to trigger ur loads to maintain the load balancing..
    If one Application server is too busy then u can check the other Application Servers in the systems..
    And u can shedule the loads on a specific application sever level as well using the PC..
    Thanks
    I hope this is clear to u..
    Assign points if this helps

  • Dose the serial number need to be changed and how when selling Adobe Photoshop Elements 9

    Dose the serial number need to be changed and how when selling Adobe Photoshop Elements 9

    No, the serial number goes with the product. You should deactivate all your installed copies before selling it. Also, if you've used it qualify for upgrade pricing on a later version you can't sell it. Well, you could but the new owner won't be able to install it.
    Adobe does have a license transfer document, but not many people bother with it:
    Transfer an Adobe product license

  • How can I check when my Apple Care runs out and how old my macbook is?

    Thinking of selling my macbook and going for a macbook pro but I need to find out some more details about it first!
    so, How can I check when my Apple Care runs out and how old my macbook is?

    Enter your serial number here https://selfsolve.apple.com/agreementWarrantyDynamic.do

  • How to split the blob byte array and insert in oracle

    how to split the blob byte array and insert in oracle
    I am having a string which is of more than lenght 4000 so i am using BLOB datatype as input to get the string.
    need to split the blob in oracle and store in the different column
    The string is of bytearray i need to strore it in each column based on the byte array.

    this will be my input i need to split the above and store it in different columns in a table.
    for spliting say
    Column1 -1 byte
    Column2-3 byte
    Column3-5 byte
    ColumnN-5 byte
    Table will have corresponding data type
    Column1 - number(10,2)
    Column2 - Float
    Column3 - Float
    ColumnN-Float
    here Column2 datatype is float but it will always have 3 byte information.
    where as Column3 datatype is also float but it will always have 5 byte information.
    Say N is Column 120

  • How to add fields to already loaded cube or dso and how to fill records in

    how to add fields to already loaded cube or dso and how to fill  it.can any one tell me the critical issues in data loading process..?

    This is sensitive task with regards to large volumes of data in infoproviders.
    The issue is to reload of data in case of adjusted structures of infoproviders.
    Indeed there are some tricks. See following:
    http://weblogs.sdn.sap.com/cs/blank/view/wlg/19300
    https://service.sap.com/sap/support/notes/1287382

  • How to verify my account using my yahoo email? and how to open my apple id in what mail in iphone 4?

    how to verify my account using my yahoo email? and how to open my apple id in what mail in iphone 4?

    Hi stanlaw,
    Welcome to the Support Communities!
    The information below should help you with this.
    Associating and verifying email addresses with your Apple ID
    http://support.apple.com/kb/HE68
    How to verify the primary email address for your Apple ID
    When you first create an Apple ID (using your email address) a verification email will be sent to that address. If you sign in to your Apple ID from the link in that email, the email address will be verified as the primary email address for your Apple ID. You can also resend the email verification if the email address is not verified:
    1. Sign in to My Apple ID to manage your account information.
    2. Click Resend under Primary Email Address.
    3. Verify your changes by following the link in the email you will receive from Apple and signing back in to your account.
    I hope this information helps ....
    Happy Holidays!
    - Judy

  • How can I edit my website from another computer? and how can I create a new website next to the one, I have already? Can anyone help, please?

    How can I edit my website from another computer? and how can I create a new website next to the one, I already have? Can anyone help, please?

    Move the domain.sites file from one computer to the other.
    The file is located under User/Library/Application Support/iWeb/domain.sites.  Move this file to the same location on the other computer and double click and iWeb will open it.  Remember, it is your User Library that you want and not your System Library, as you will not find iWeb there.
    Just create a new site on the same domain file and it will appear below the other site.  If you want them side by side then duplicate your domain file and have one site per a domain file and they can then be side by side.

  • How to enable root on mac on 10.9.2 and how to set the password for the same ?

    how to enable root on mac on 10.9.2 and how to set the password for the same ?

    http://support.apple.com/kb/ht1528
    Follow the steps for Lion.
    But, why are you doing this? I've never found the need to do that.

  • How can I found out the No. of Psocess running and How can I Release them

    Dear experts,
    How can I found out the No. of Psocess running and How can I Release them.
    I have 1GB RAM with oracle 10G. and please tell me How many processes can run with this RAM.

    >How can I found out the No. of Psocess running
    well, that depends on where you are ? if you are on windows then task manager will tell you what all processes are running. if you are on unix then ps -ef will tell you about all the processes running on a particular machine
    How can I Release them.
    what do you exactly mean by Release ? if you mean "end" that again has 2 scenarios, first that process ends by itself (ie after completing its job), another can be killing the process , that again will depend upon operating system. in windows you can kill a process from task manager itself, in unix you can use kill -9 PID to kill a process.
    How many processes can run with this RAM.
    loads of other details required before one can answer this question.no of processes in a very simple manner will depend how much memory is available and how much a process is eating.
    Sidhu

  • How to create PDF with Form Builder (T-Code:SPF) and how to use it?

    How to create PDF with Form Builder (T-Code:SPF) and how to use it? Is there anyone can show me some doc. or PA material ? << removed >>  Thank you very much!!
    Edited by: Rob Burbank on Nov 11, 2010 1:04 PM

    PDF forms also known as Adobe From or Interactive Forms.
    Check this link -
    Interactive Forms
    REG:ADOBE FORM
    Adobe forms
    Regards,
    Amit

  • HT4993 on my computer there are two different accounts for the itunes store but my brothers account keeps syncing in on my iphone instead of my own account how do i get his account off of my phone and add my own back?

    on my computer there are two different accounts for the itunes store but my brothers account keeps syncing in on my iphone instead of my own account how do i get his account off of my phone and add my own back?

    Not a good idead to share IDs
    Read http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    Read Sharing an Apple ID with your Family
    Does your father have a recent backup of his phone?  If so restore his phone from that.  Please not that everythign created on th ephone since the backup was made will be lost

  • How is the 'import-packages' information saved in the database, and how long?

    Hello,
    I am  developping a ECM Connector for Adobe LiveCycle ES, which is a customized component.
    1 - Who should I contact to have some specific support  ?
    There is no detailed information yet on this on the adobe site  (http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/wwhelp/wwhimpl/js/html/w whelp.htm?href=000931.html&accessible=true) .
    If you  think that I should address my problem to another department of Adobe, please  tell me which department?
    I give you another description of my problem. In fact, I have  been investigating on it.
    2 - If I  put this in my component.xml file, in step  1:
    <component-id>com.rsd.adobe.livecycle.RSDFoldersConnector</component-id>
    <version>1.0</version>
    <import-packages><package  version="1.0">com.rsd.simpleApiFolders</package>  </import-packages>
    If I change the  version to 1.1 and remove the  'import-packages' (in step 2) , will the new component need the  com.rsd.simpleApiFolders package. It seems that is still needs it.
    3 - How is the  'import-packages' information saved in the  database, and how  long?
    In  fact, on thursday, I used 'import-packages'  to make a test. And since them, I  can not deploy any of my components.
    LiveCycle throws a  ClassNotFoundException.
    ALC-DSC-000-000: com.adobe.idp.dsc.DSCRuntimeException:  Internal error.
    [java] at  com.adobe.idp.dsc.registry.component.impl.ComponentRegistryImpl$6.doInTransaction(Compone ntRegistryImpl.java:338)
    ... Caused  by: java.lang.ClassNotFoundException: http-0.0.0.0-8080-1Class name  com.rsd.simpleApiFolders.Context from package com.rsd.simpleApiFolders not found.
    [java] at  com.adobe.idp.dsc.DSContainerSearchPolicy.searchClassUsingParentFirst(DSContainerSearchPo licy.java:234)
    Thank you in advance
    Regards.

    1 - Who should I contact to have some specific support  ?
    That would depend on your Adobe support contract and if your organization has a TAM assigned.  You should check with your organization's Adobe contact and see what support options your organization has purchased.
    Having said that, this forum has a few people that may be able to help (but the forum does not have a SLA associated with it)
    2 - If I  put this in my component.xml file, in step  1:
    <component-id>com.rsd.adobe.livecycle.RSDFoldersConnector</component-id>
    <version>1.0</version>
    <import-packages><package  version="1.0">com.rsd.simpleApiFolders</package>  </import-packages>
    If I change the  version to 1.1 and remove the  'import-packages' (in step 2) , will the new component need the  com.rsd.simpleApiFolders package. It seems that is still needs it.If your component class needs the simpleApiFolders class then yes, you still need it.  Think of import-packages like a class-path statement (but with packages and not jars).  Its not physically moving the package into your application, but allowing you to access it from another container.
    3 - How is the  'import-packages' information saved in the  database, and how  long?
    As far as I know they are not imported into the database. As I stated above, I believe that the import-packages just allows you to point to classes that are in the app server's classpath, but are not physically in you component jar file.  As long as that class is in the app server class-path (or in the Adobe EAR file) then you should be able to access it.  Is the jar file containing the simpleApiFolders class in the app server's lib directory?

Maybe you are looking for