Interview Solution

For a long time it puzzled me how something so expensive, so leading edge, could be so useless. And then it occurred to me that a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match. Bill Bryson

Big Or Little Endian

Language Java | Level Intermediate | Category Interview Problems | July 24, 2015 4:52 pm

Comments


Interview Problem

How to find the machine is big endian machine or little endian machine.
Write a program to find the machine is big endian or little endian. The terms endian and endianness refer to the convention used to interpret the bytes making up a data word when those bytes are stored in computer memory.
Each byte of data in memory has its own address. Big-endian systems store the most significant byte of a word in the smallest address and the least significant byte is stored in the largest address. Little-endian systems, in contrast, store the least significant byte in the smallest address.
Example:-
Return LITTLE_ENDIAN or BIG_ENDIAN based on machine type


Output

   					 
xxxx machine JVM is LITTLE_ENDIAN

				    

Comments



Please login to add comments.