Integer reverseBytes Method in Java

Samual Sam
Updated on 26-Jun-2020 10:39:16

120 Views

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 Explained

Nancy Den
Updated on 26-Jun-2020 10:39:16

2K+ Views

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

Convert Java Boolean Primitive to Boolean Object

karthikeya Boyini
Updated on 26-Jun-2020 10:38:52

4K+ Views

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

Convert Java String Object to Boolean Object

Samual Sam
Updated on 26-Jun-2020 10:38:28

2K+ Views

A string object can be created in Java using the string literal.String myStr = “Amit”;Another way to create a string object is using the new keyword.String myStr = new String("Hello!");We have used the first method to create a string object.String str = "true";Now, use the valueOf() method to convert String Object to Boolean Object. We have used this method on Boolean object.Boolean bool = Boolean.valueOf(str);Let us now see the complete example to show how to convert String Object to Boolean Object.Example Live Demopublic class Demo {    public static void main(String[] args) {       String str = "true";   ... Read More

What is the Human Brain Made Of

Shanmukh Pasumarthy
Updated on 26-Jun-2020 10:38:15

335 Views

In the Central Nervous System, Human Brain is the main organ. It comprises of the cerebrum, the brain stem, and the cerebellum. It controls the vast majority of the body activities, processing, incorporating, and coordinating the data it gets from the sensory organs and deciding the instructions sent to the rest of the body. The mind is contained in and secured by the skull bones of our head.The human cerebrum is mainly made up of neurons, glial cells, and veins. Interneurons, pyramidal cells including Betz cells, motor neurons, and cerebellar Purkinje cells are the various types of neurons. Betz cells are ... Read More

Create Boolean Object from Boolean Value in Java

karthikeya Boyini
Updated on 26-Jun-2020 10:37:57

3K+ Views

To create a Boolean object from Boolean value is quite easy. Create an object with Boolean and set the Boolean value “true” or “false”, which are the Boolean literals.Let us now see how “true” value is added.Boolean bool = new Boolean("true");In the same way, “False” value is added.Boolean bool = new Boolean("false");The following is an example displaying how to create a Boolean object from Boolean value.Example Live Demopublic class Demo {    public static void main(String[] args) {       Boolean bool = new Boolean("true");       System.out.println(bool);       bool = new Boolean("false");       System.out.println(bool); ... Read More

Convert Boolean to String in Java

karthikeya Boyini
Updated on 26-Jun-2020 10:37:05

11K+ Views

To convert Boolean to String in Java, use the toString() method. For this, firstly, we have declared two booleans.boolean bool1 = false; boolean bool2 = true;Now, convert Boolean to String using the toString() method in Java as shown below −String str1 = new Boolean(bool1).toString(); String str2 = new Boolean(bool2).toString();Now, when you will display the values “str1” and “str2”, the output would be in String.Let us now see the complete example to convert Boolean to String.Example Live Demopublic class Demo {    public static void main(String[] args) {       boolean bool1 = false;       boolean bool2 = true; ... Read More

Read Integers from Console in Java

Samual Sam
Updated on 26-Jun-2020 10:36:26

20K+ Views

To read integers from console, use Scanner class.Scanner myInput = new Scanner( System.in );Allow a use to add an integer using the nextInt() method.System.out.print( "Enter first integer: " ); int a = myInput.nextInt();In the same way, take another input in a new variable.System.out.print( "Enter second integer: " ); Int b = myInput.nextInt();Let us see the complete example.Exampleimport java.util.Scanner; public class Demo {    public static void main( String args[] ) {       Scanner myInput = new Scanner( System.in );       int a;       int b;       int sum;       System.out.print( ... Read More

Convert Short to Numeric Primitive Data Types in Java

karthikeya Boyini
Updated on 26-Jun-2020 10:35:31

361 Views

To convert Short to numeric primitive data types, use the following methods −byteValue() shortValue() intValue() longValue() floatValue()Firstly, let us declare a Short.Short shortObj = new Short("40");Now, let us see how to convert it to long type, for a simple example.long val5 = shortObj.longValue(); System.out.println("Long: "+val5);In the same way, you can convert it to other primitive data types as shown in the complete example below.Example Live Demopublic class Demo {    public static void main(String []args) {       Short shortObj = new Short("40");       byte val1 = shortObj.byteValue();       System.out.println("Byte: "+val1);       int val2 ... Read More

Convert Byte Primitive Type to Byte Object in Java

Samual Sam
Updated on 26-Jun-2020 10:33:57

1K+ Views

To convert byte primitive type to Byte object, use the Byte constructor.Here is our byte primitive type.byte b = 100;Now let us convert it to Byte object.Byte res = new Byte(b);Let us see the complete example.Example Live Demopublic class Demo {    public static void main(String[] args) {       byte b = 100;       Byte res = new Byte(b);       System.out.println(res);    } }Output100

Advertisements