Why do not need to worry about Big and little Endian in Java

Please help, I do not understand this concept please explain.
The architecture of a CPU is either little-endian or big-endian; some modern CPU's allow a choice via software.
The TCP/IP protocol standard specifies that all the bytes that make up an item must be sent in "network order", which happends to be big-endian. Intel Pentium CPU's are little-endian.
This implies that on an Intel machine the TCP software will have to chop an int into bytes and then reverse the bytes before transmitting them.
Why does the JAVA TCP software does not need to perform the reversal?
Thanks,
Alex

Java doesn't give you direct access to the individual bytes of a larger data item such as an integer. For this reason you don't have the usual endian problems that occur in C. The actual handling of this is in the DataOutputStream and DataInputStream where the integer is coverted to and from bytes using arithmetic, not by fiddling with the internal structure.
Note that regardless of the machine architecture the operation value%256 will return the low order 8 bits. It's less efficient than assigning an int* to a char*, but it's not fraught with the endian problems or any of the other hardware baggage.

Similar Messages

  • TCP Programming / Why do not need to worry about Big and little Endian?

    Please help, I do not understand this concept please explain.
    The architecture of a CPU is either little-endian or big-endian; some modern CPU's allow a choice via software.
    The TCP/IP protocol standard specifies that all the bytes that make up an item must be sent in "network order", which happends to be big-endian. Intel Pentium CPU's are little-endian.
    This implies that on an Intel machine the TCP software will have to chop an int into bytes and then reverse the bytes before transmitting them.
    Why does the JAVA TCP software does not need to perform the reversal?
    Thanks,
    Alex

    But why would I need to use the DataOutputStream,You don't have to.
    But that's what the Java API provides for sending java primitives over a stream. You wouldn't have to use that. You could chop the int into bytes yourself, and send the bytes, and your Java code still wouldn't have to worry about the endiannes of it, because the VMs handle that.
    DataOutputStream just does the chopping and reassembling for you, so it's easier than doing it yoursefl.

  • I have upgraded my MacBook Pro 15 late 2011 to 8Gb RAM, now when I go to about this mac in it more info it doesn't show AMD graphics card as it used to before, it just show  Intel HD Graphics 3000 512 MB is that a problem that I need to worry about?

    I have upgraded my MacBook Pro 15 late 2011 to 8Gb RAM, now when I go to about this mac in it more info it doesn't show AMD graphics card as it used to before, it just show  Intel HD Graphics 3000 512 MB is that a problem that I need to worry about?
    and in system report >> hardware >> Graphics/Display >> it shows both grafics card listed.

    Some Mac's when the RAM is increased the Intel HD 3000 integrated graphics will bump itself up to the higher video RAM it takes, this seems to be what occured.
    It also means the dedicated graphics card will be used less, but only so slightly less.
    You obviously still should have both, you can test this by turning off Graphics Switching in Energy Saver, that will use the decicated AMD card all the time.
    You can also run Cinebench and compare the scores here
    Mac video card performance

  • Big Endian and Little Endian formats.

    How can I read numbers from file in both big and little endian formats?

    Not without reading them a byte at a time and doing
    bit-shifting arithmetic yourself.I was hoping I will not get that kind of answer :) Well, if that's the only way,
    can you tell me what kind of format is used in Java? Big or Little endian?

  • Do I need to worry about this?

    It has been an interesting few months with my one year old 13" MBP. Lots of spinning beach balls followed by a hard drive crash. Apple was quick to replace the hard drive. And as I had everything backed up on Time Machine I was able to quickly restore everything.
    All was good for a few months until the beachballs, freezes, and finder crahes began again. Made another trip to the Genius bar where they thought I might have re-downloaded a corrupt file from Time Machine. They cleaned my temp files and caches and things seemed to work well in the store.
    When I returned home I had the same issues. They had prepared me for this. So a system restore, a re mount and re start of time capsule and everything seems to be working well. Speedy, no crashes, no freezes.
    The issue is that I wanted to double check so I ran disk verify and permission verify on the disk utility. To my surprise it came back with a LONG error log as below. So long, I could not get it all into this post. But it seems like a recurrent message. Do I need to worry about any of this? What should I do next, if anything? Thanks in advance for your response.
    Verifying volume “Macintosh HD”
    Performing live verification.
    Checking Journaled HFS Plus volume.
    Checking extents overflow file.
    Checking catalog file.
    Checking multi-linked files.
    Checking catalog hierarchy.
    Checking extended attributes file.
    Checking volume bitmap.
    Checking volume information.
    Invalid volume file count
    (It should be 624512 instead of 624514)
    Invalid volume directory count
    (It should be 172781 instead of 172779)
    The volume Macintosh HD was found corrupt and needs to be repaired.
    Error: This disk needs to be repaired. Start up your computer with another disk (such as your Mac OS X installation disc), and then use Disk Utility to repair this disk.
    Verify permissions for “Macintosh HD”
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUAdvanced.nib/keyedobjects.nib", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUAdvanced.nib/keyedobjects.nib", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUAssistant.nib/keyedobjects.nib", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUAssistant.nib/keyedobjects.nib", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUDocument.nib/keyedobjects.nib", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUDocument.nib/keyedobjects.nib", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUDrives.nib/keyedobjects.nib", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUDrives.nib/keyedobjects.nib", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUStatisticsPanel.nib/keyedobjects.nib ", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUStatisticsPanel.nib/keyedobjects.nib ", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUTaskSheet.nib/keyedobjects.nib", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUTaskSheet.nib/keyedobjects.nib", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUTasks.strings", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUTasks.strings", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUWirelessPanel.nib/keyedobjects.nib", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUWirelessPanel.nib/keyedobjects.nib", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/APPanels.nib/keyedobjects.nib", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/APPanels.nib/keyedobjects.nib", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AUFirmwareDownloader.nib/keyedobjects.n ib", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AUFirmwareDownloader.nib/keyedobjects.n ib", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortAssistant.strings", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortAssistant.strings", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortErrors.strings", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortErrors.strings", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortSettings.strings", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortSettings.strings", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortTimeZones.strings", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortTimeZones.strings", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortUtilityHelp/AirPortUtilityHelp.h elpindex", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortUtilityHelp/AirPortUtilityHelp.h elpindex", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortUtilityHelp/AirPortUtilityHelp.h tml", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortUtilityHelp/AirPortUtilityHelp.h tml", should be -rw-r--r-- , they are -rw-rw-r-- .

    Scott Adelman wrote:
    The issue is that I wanted to double check so I ran disk verify and permission verify on the disk utility. To my surprise it came back with a LONG error log as below. So long, I could not get it all into this post. But it seems like a recurrent message. Do I need to worry about any of this? What should I do next, if anything?
    Verifying volume “Macintosh HD”
    Invalid volume file count
    (It should be 624512 instead of 624514)
    Invalid volume directory count
    (It should be 172781 instead of 172779)
    The volume Macintosh HD was found corrupt and needs to be repaired.
    Error: This disk needs to be repaired. Start up your computer with another disk (such as your Mac OS X installation disc), and then use Disk Utility to repair this disk.
    You definitely need to repair your disk. If you can, boot from something else, such an external disk or the system discs that came with your Mac. You can also cause the disk to be repaired by booting into "Safe Mode": http://support.apple.com/kb/ht1564 . If that process can't repair your disk, you may need one of the more-powerful disk utilities such as Disk Warrior.
    Verify permissions for “Macintosh HD”
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUAdvanced.nib/keyedobjects.nib", should be 0, group is 80.
    You can ignore most permissions repair messages:
    http://support.apple.com/kb/TS1448

  • Do I need to worry about these event handlers in a grid from a memory leak perspective?

    I'm pretty new to Flex and coudn't figure out how to add event handlers to inline item renderer components from the containing file script so I attached the listnerers simply as part of the components themselves (eg <mx:Checkbox ... chnage="outerDocument.doSomething(event)"../>):
    <mx:DataGrid id="targetsGrid" width="100%" height="100%" doubleClickEnabled="true" styleName="itemCell"
          headerStyleName="headerRow" dataProvider="{targets}"
          rowHeight="19" fontSize="11" paddingBottom="0" paddingTop="1">
         <mx:columns>
         <mx:DataGridColumn width="78" dataField="@isSelected" headerText="">
         <mx:itemRenderer>
              <mx:Component>
                   <mx:HBox width="100%" height="100%" horizontalAlign="center">
                        <mx:CheckBox id="targetCheckBox" selected="{data.@isSelected == 'true'}"
                             change="outerDocument.checkChangeHandler(event);"/>
                        <mx:Image horizontalAlign="center" toolTip="Delete" source="@Embed('/assets/icons/delete.png')" useHandCursor="true" buttonMode="true"
                             click="outerDocument.deleteHandler(event);"/>
                        <mx:Image id="editButton" horizontalAlign="center" toolTip="Edit" source="@Embed('/assets/icons/edit-icon.png')" useHandCursor="true" buttonMode="true"
                             click="outerDocument.editHandler(event);"/>
                   </mx:HBox>
              </mx:Component>
         </mx:itemRenderer>
         </mx:DataGridColumn>
              <mx:DataGridColumn id="Name" dataField="@collectionDesc" headerText="Name" itemRenderer="com.foobar.integrated.media.ui.component.CellStyleForTargetName"/>
              <mx:DataGridColumn id="Created" width="140" dataField="@createDateTime" headerText="Created"  labelFunction="UiHelper.gridDateFormat" />
         </mx:columns>
    </mx:DataGrid>
    This grid is part of a view that will get destroyed and recreated potentially many times during a user's session within the application (there's a large dynamic nature to the app and views are created at run-time.) By destroyed I mean that the view that holds the above datagrid will no longer be referenced under certain circumstances and an entire new view object is created (meaning the old datagrid is no longer refernced and a new one is created.)
    I heard you should clean up event handlers when they are no longer used, and I know at what point the view is destroyed, but I don't know how to clean up the event handlers added to the item renderer components? Is it something that the Flex garbage collector will handle efficiently?
    Also, on a somewhat related note, how could I push the item renderer to an external component since in my event handlers for the item renderer buttons I need a reference to the datagrid.selectedIndex which, as an external item renderer I wouldn't have access to this containing grid?

    No. You don't need explicit cleanup in this case: if your outerDocument is going away, you have nothing to worry about. The event handler leak can happen in sort of the reverse situation: suppose you have a long-lived MyView that contains a custom DataGrid like the one below. Now suppose that MyView frequently destroys and re-creates the grid. And suppose that on its creationComplete event, the grid registers a listener for outerDocument's (MyView's) enterFrame Event. Unless you explicitly remove this listener, MyView will still have a reference to it even after the grid that registered the listener is destroyed (and garbage collected).
    This is a pretty contrived example, but it sort of illustrates the potential for leaks: a certain component is elligible for garbage collection, but some longer-lived component holds a reference to it (or part of it, such as a listener function). If the longer-lived component is elligible for GC as well, you don't really need to worry about proper cleanup. That's what you're paying the GC processor cycles for.

  • Why do you need to go about linking to services-config.xml in your flex compiler

    Why do you need to go about linking to services-config.xml in
    your flex compiler when you want to do remoting. It just seems like
    a complicated way to do things.

    Yeah I find this perplexing as well. I'm guessing it has something to do with Opalis origins perhaps.
    Would be good to understand why.

  • Why has not received the message about the change secret Questions?

    Why has not received the message about the change secret Questions on my email?

    Be patient. You don't get an immediately notification email. Record the Claim Number somewhere in case something goes wrong. It can take up to 72 hours. I got mine in about 54 hours.

  • Why do we need to define RFC destination and user for material replication

    Dear Experts,
    why do we need to define RFC destination and user for material replication? Here we use crm middleware only for material replication. Could you please help me to understand it?
    regards,
    Ranjan

    Hello,
    As far as I know, you can use the same RFC destination already available in ECC to SRM to replicate materials.
    You can refer to note 720819.
    Regards,
    Ricardo

  • What is happening to 7.0.3? why do we need to connect to itunes and restore for 2 hours?

    what is happening to 7.0.3? why do we need to connect to itunes and restore for 2 hours? such a waste of time.

    No clue as you've provided not details.
    What exactly is the problem that was occuring that prompted you to restore via iTunes?

  • HT201250 If time machine backups hourly.  Why does it need to backup daily, weekly and monthly

    If time machine backups hourly.  Then why does it need to backup daily, seekly, and monthly?

    It doesn't.
    What it does is discard intermediate backups at the end of 24 hrs and keep just three spaced backups from the previous day.
    At the end of the next day, that day's will be reduced to 3, and the previous 3 trimmed to one; the last backup of that day.
    Daily backups are kept for a month, then trimmed to the last backup of the week.
    The weekly backups are kept until the disc runs out of space and TM starts deleting the oldest ones.

  • Why do we need separate t.codes KB11N and KB41N for reposting costs & rev?

    Hi,
    Why do we need separate t.codes KB11N and KB41N for reposting costs and revenues? I noticed that i can still use one t.code KB11N to post both costs and revenues, hence why do we need a separate t.code KB41N for revenues?

    Hi,
    The BAPI for costs allows more options than the one for revenues. For example, via BAPI_ACC_PRIMARY_COSTS_POST  you can select sender Network, what you cannot do via BAPI_ACC_REVENUES_POST. The same is for 'cost object' as a receiver; you can do it only via BAPI for costs. In other aspects, the BAPI for costs could be used to repost revenues as well.
    Regards,
    Eli

  • Any need for conversation from big endian and little endian?

    Hi,
    I am planning to migrate an Oracle 9i Database on AIX 5.3 to Oracle 11g R2 Windows 2008, and have planned to use transportable tablespace. But prior to that task is the conversation required from big endian and little endian using RMAN?
    Appreciate any suggestions, comments and hints
    Thanks

    Hi,
    Check V$TRANSPORTABLE_PLATFORM, it shows the ending for each supported platform. Given the results on my 11g, I suspect that you'll have to convert the tablespaces...
    SYSTEM@oracle11 SQL>select *
      2   from V$TRANSPORTABLE_PLATFORM
      3  ;
    PLATFORM_ID PLATFORM_NAME                                                                                         ENDIAN_FORMAT
              7 Microsoft Windows IA (32-bit)                                                                         Little
              6 AIX-Based Systems (64-bit)                                                                            Big
              8 Microsoft Windows IA (64-bit)                                                                         Little
             12 Microsoft Windows x86 64-bit                                                                          LittleHtH
    Johan

  • Help: Any one can advice, CVI software is using Big or little endian?

    Help: Any one can advice, CVI is using Big or little endian? 
    or is depend on the processors my HW is using?

    The correct answer it the third one: CVI adapts to the hardware architecture you are running on. In the Programmer's Toolbox you have functions to detect the hardware architecture: HostIsBigEndian and HostIsLittleEndian. In the group you have functions to convert data between architectures.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Big to Little Endian

    http://download.oracle.com/docs/cd/B14117_01/server.101/b10770/rcmsynta18.htm#87809
    DB Version : 10.1
    We are going across platform, different endianness.
    1. We cannot use CONVERT Database as it is supported only across same platform.
    2. We are planning to use CONVERT Datafile, without transportable tablespace.
    3. Any idea on how much time it would take to copy a 10g File ?
    When there is a endian difference, could you please provide a high level successful methodology to use.
    We are planning to do an OS cold backup, subsequent restore of the entire database on Target, run convert datafile and synchronizing the data from there on. BTw, we are going from Big to Little Endian.
    Can any one provide a estimate on how much time it would take to convert a 10 Gig datafile?
    Also once datafile is converted and brought up, can we apply the archivelog’s I am thinking no, but wanted to know your opinion.
    Edited by: user11986212 on Nov 30, 2009 8:13 PM

    Hi,
    I wrote blog post recently about cross platform migration from big to little endian platform:
    [Cross-platform migration - large Oracle 9i db from Solaris 64 to Linux 64|http://msutic.blogspot.com/2009/11/cross-platform-migration-large-oracle.html]
    First part is upgrade process and you can ignore that part - next is migration across platforms.
    Maybe this post could be helpful for you.
    Regards,
    Marko

Maybe you are looking for

  • Error in deploying .jar file from JDeveloper 10.1.3.5

    Hello, I want to deploy .jar file in a machine, instead of having to install JDeveloper to run the application (it contains: Web Services and Data Base). I have followed the following steps in JDeveloper to create the .jar file: 1) Right click over t

  • Need help setting up Powerbook G4 to Belkin Wireless G Router 802.11g

    Cannot get the laptop to go online, says "the specified server could not be found. Called my internet provider, Belkin and no one can get it online. Can anyone give me the steps to setting up the laptop maybe the settings are not right? I bought an a

  • FIlming Videos With Photo Booth

    Quick question. I filmed a little video, around 4 minutes on Photo Booth, and uploaded it to Facebook, but after around 15 seconds, the video stopped, but the audio kept going, and when I tried looking it up on my computer, the video was only 15 seco

  • Merging Sequences

    So. I have been working on a video which i have divided into two separate sequences now i am trying to merge them into one sequences and final cut is being rather strange. When i try and copy and paste i lose one of the clips in the middle of the seq

  • ITunes Match is driving me crazy! Greyed out songs on my devices

    I add a new song to my library in iTunes on my Mac, and then select "Update iTunes Match" from the Store window. Then I go to my iOS devices (iPhone, iPad) to see if they appear. They do, but they are always greyed out. This happens EVERY time. (Note