To check two numbers for equality in Java, we can use the Equals() method as well as the == operator.Firstly, let us set Integers.Integer val1 = new Integer(5); Integer val2 = new Integer(5);Now, to check whether they are equal or not, let us use the == operator.(val1 == val2)Let us now see the complete example.Example Live Demopublic class Demo { public static void main( String args[] ) { Integer val1 = new Integer(5); Integer val2 = new Integer(5); Integer val3 = new Integer(10); System.out.println("Integer 1 = "+val1); ... Read More
When it comes to Engineering jobs in India, thousands of Government vacancies and lakhs of jobs in the Indian private sector come up every month. There is no dearth of jobs for engineers in India. But if you are interested to go abroad, there are many places around the world to go.These days many students are preferring to look for some good jobs in India itself. Due to Visa hassles and insecurity, many youngsters are preferring to settle down in their homeland. That is a welcome trend.
In this program, we will see how to multiply two 8-bit numbers using 8085 microprocessor.Problem StatementWrite 8085 Assembly language program to multiply two 8-bit numbers stored in a memory location and store the 16-bit results into the memory.DiscussionThe 8085 has no multiplication operation. To get the result of multiplication, we should use the repetitive addition method. After multiplying two8-bit numbers it may generate 1-byte or 2-byte numbers, so we are using two registers to hold the result.We are saving the data at location 8000H and 8001H. The result is storing at location 8050H and 8051H.InputAddressData......8000DC8001AC......Flow DiagramProgramAddressHEX CodesLabelsMnemonicsCommentsF00021, 00, 80LXIH, 8000HLoad first ... Read More
Use the parseInt() method with the second parameter as 16 since it is the radix value. The parseInt() method has the following two forms.static int parseInt(String s) static int parseInt(String s, int radix)To convert hex string to decimal, use the 2nd syntax and add radix as 16, since hexadecimal radix is 16.Integer.parseInt("12", 16)Example Live Demopublic class Demo { public static void main( String args[] ) { // converting to decimal System.out.println(Integer.parseInt("444", 16)); } }Output1092
Use the parseInt() method with the second parameter as 8 since it is the radix value. The parseInt() method has the following two forms.static int parseInt(String s) static int parseInt(String s, int radix)To convert octal to decimal, use the 2nd syntax and add radix as 8, since octal radix is 8.Integer.parseInt("25", 8)The following is an example.Example Live Demopublic class Demo { public static void main( String args[] ) { // converting to decimal System.out.println(Integer.parseInt("25", 8)); } }Output21
In this program, we will see how to divide two 8-bit numbers using 8085 microprocessor.Problem StatementWrite 8085 Assembly language program to divide two 8-bit numbers and store the result at locations 8020H and 8021H.DiscussionThe 8085 has no division operation. To get the result of the division, we should use the repetitive subtraction method. By using this program, we will get the quotient and the remainder. 8020H will hold the quotient, and 8021H will hold the remainder.We are saving the data at location 8000H and 8001H. The result is storing at location 8050H and 8051H.InputThe Dividend: 0EHThe Divisor 04HThe Quotient will be ... Read More
Use the toHexString() method to convert decimal to hexadecimal. The method returns a string representation of the integer argument as an unsigned integer in base 16. The following characters are used as hexadecimal digits:0123456789abcdef.The following is the syntax.String toHexString(int i)It has only single parameter.i − This is an integer to be converted to a string.Example Live Demopublic class Demo { public static void main( String args[] ) { int dec = 45; System.out.println("Decimal = "+dec); // converting to hex System.out.println(Integer.toHexString(dec)); } }OutputDecimal = 45 2d
The Boolean literals have two values i.e. True and False.The following is an example to display Boolean Literals.Example Live Demopublic class Demo { public static void main(String[] args) { System.out.println("Boolean Literals"); boolean one = true; System.out.println(one); one = false; System.out.println(one); } }OutputBoolean Literals true falseIn the above program, we have declared a boolean value and assigned the boolean literal “true”.boolean one = true;In the same way, we have added another boolean literal “false”.one = false;Both of the above values are displayed, which are the boolean literals.
The Integer.rotateLeft() method returns the value obtained by rotating the two's complement binary representation of the specified int value i left by the specified number of bits. The following is the syntax.int rotateLeft(int i, int distance)Here are the parameters.i − This is the int value.distance − This is the rotation distance.Example Live Demopublic class Demo { public static void main(String []args) { int val = 1; for (int i = 0; i < 4; i++) { val = Integer.rotateLeft(val, 1); System.out.println(val); } } }Output2 4 8 16
The method returns the signum function of the specified int value. Let us now see the syntax.int signum(int i)Here is the parameter.i − This is the int valueThe return value is -1 if the specified value is negative, 0 if the specified value is zero and 1 if the specified value is positive.Let us now see an example.Example Live Demopublic class Demo { public static void main(String []args) { System.out.println("Returns = "+Integer.signum(0)); System.out.println("Returns = "+Integer.signum(-99)); System.out.println("Returns = "+Integer.signum(678)); } }OutputReturns = 0 Returns = -1 Returns = 1
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP