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
The method returns the value obtained by reversing the order of the bytes in the two's complement representation of the specified int value. Let us now see the syntax.int reverseBytes(int i)The following is the parameter.i − This is the int valueExample Live Demopublic class Demo { public static void main(String []args) { System.out.println(Integer.reverseBytes(0)); System.out.println(Integer.reverseBytes(-87)); System.out.println(Integer.reverseBytes(98)); } }Output0 -1442840577 1644167168
ODBC architecture consists of the following components.Application: An application which communicates with the databases using ODBC functions is an ODBC application.ODBC driver manager: The ODBC diver manager manages the underlying drivers in an application. Whenever an application calls a function of ODBC API to communicate with a database, the driver manager accepts those function calls and passes them to the ODBC driver. When the driver retrieves the results from the database the driver manager accepts the results from the driver and returns it back to the application.ODBC driver: The ODBC driver accepts the application function calls from the driver manager ... Read More
To convert Boolean Primitive to Boolean object, use the valueOf() method in Java.Firstly, let us take a boolean primitive.boolean val = false;To convert it into an object, use the valueOf() method and set the argument as the boolean primitive.Boolean res = Boolean.valueOf(val);Let us see the complete example to learn how to convert Boolean Primitive to Boolean object.Example Live Demopublic class Demo { public static void main(String[] args) { boolean val = false; // converting to object Boolean res = Boolean.valueOf(val); System.out.println(res); } }OutputFalse