Gagana S

Posts By Gagana S

  • Short Data Type in Java
    Short Data Type in Java | As we all know there are two types of data types in java, primitive and non-primitive data types. Primitive data types are fundamental data types whereas the non – primitive data types are derived data types. Among them short is one of the primitive data types in Java which basically belongs to the integer type. Integer has been divided into four data types again based… Read more: Short Data Type in Java
  • Byte Short Int Long Range In Java
    Byte Short Int Long Range In Java | There are eight different primitive data types in Java, they are char, Boolean, double, float, long, Int, byte, and short. As per the scope of this blog, we are just concentrating on the following data types: Byte, Short, Int, and Long. The byte, short, int, and long data types are all integer data types, which means they only store the numeric value.… Read more: Byte Short Int Long Range In Java
  • Long Data Type In Java
    Long Data Type In Java | The Long is one of eight primitive data types in Java, it is also called the fundamental data type. The long data type is the type of integer that stores only the numeric values but not the floating point numbers containing the decimal value. The long can occupy the largest memory space up to 64 bits, that is it ranges from -9223372036854775808 to 9223372036854775807… Read more: Long Data Type In Java
  • Java Integer parseInt() Method
    Java Integer parseInt() Method | The parseInt() method of the Integer class parses the string object into an integer. Here the string object must contain integer values except for the first character which can be an ASCII character in order to indicate the sign of the integer that is ‘+/-’ indicating a positive or negative integer. Also see:- Java Integer hashCode() Method Java Integer parseInt() Method Syntax There are three… Read more: Java Integer parseInt() Method
  • Integer To Long in Java
    Java Integer To Long | The Integer object of the wrapper class can be converted to the primitive data types are you wondering how? Yes, Java provides various methods to convert objects into primitive ones. In other blogs, we have converted Integer objects to int and int arrays as well. “Long” is a wrapper class whereas “long” is a primitive data type. Similarly, “Integer” is a wrapper class whereas “int”… Read more: Integer To Long in Java
  • Java List Integer To Int Array
    Java List Integer To Int Array | Here we will discuss how to convert an integer list to an int array in Java. In Java, there are various methods to convert the object to a primitive data type. We will see some of them here. Following are the different ways to convert List Integer To int Array:- Convert Integer List To int Array in Java using Streams First, let us… Read more: Java List Integer To Int Array
  • Java Integer hashCode() Method
    Java Integer hashCode() Method | Here, we will discuss the hashCode() method given in the Integer class. This method converts the integer to the particular hash code value. The hashCode() method is defined in the java.lang.Object class, and since every Java class is a sub-class of the Object class therefore it is also available to the Integer class. The integer class overrides this method. There are two variations of the… Read more: Java Integer hashCode() Method
  • Java Integer getInteger() Method
    Java Integer getInteger() Method | Here, we are going to discuss the getInteger() method of the Integer wrapper class. The getInteger() method is used to get the integer value of the system properties with the specified name of the method argument. If there is no specified name or the argument or if the specified name is not valid then the getInteger() method throws null. Java Integer getInteger() There are three… Read more: Java Integer getInteger() Method
  • How to Convert Integer To Double in Java
    How to Convert Integer To Double in Java | The Java programming language has two types of data types:- primitive data types and non-primitive data types. There are eight primitive data types available int, char, bool, byte, short, long, float, and double. Each primitive data types require a different amount of space when stored in the memory. In this blog, we are converting the value of one primitive to another… Read more: How to Convert Integer To Double in Java
  • Convert Integer To Int in Java
    Convert Integer To Int in Java | Here, we will discuss how to convert integer to int in Java. The Integer is a wrapper class whereas the int is the primitive data type in Java. The wrapper class is the way to use primitive data types as an object. Also see:- Int vs Integer Java, Int to Integer in Java In order to convert Integer to Int we can use… Read more: Convert Integer To Int in Java
  • Int to Integer in Java
    Int to Integer in Java | In this blog, we are converting the primitive data type int to the Integer object. The int is the primitive data type whereas the Integer is a wrapper class. The wrapper class is the way to use the primitive data types in Java as objects. So here we are basically converting the data type to an object. Also see:- Int vs Integer Java, Convert Integer to… Read more: Int to Integer in Java
  • Int vs Integer in Java
    Int vs Integer in Java | In this section, we will see what’s the difference int vs integer in Java. Even though both seem to be the same but they are not. The int is a primitive data type whereas the Integer belongs to the wrapper class. Wrapper class is those that allow you to use the primitive data types as an object hence Integer here will be an object.… Read more: Int vs Integer in Java
  • Convert Byte Array To Integer In Java
    Convert Byte Array To Integer In Java | We will discuss how to convert byte array to integer in Java programming language. Both byte and int are of primitive data type in Java but the difference is the size, and also here Integer belongs to the wrapper class. The wrapper classes help us to use primitive data types as objects. Here we will be converting a byte array into an… Read more: Convert Byte Array To Integer In Java
  • Java Integer decode() Method
    Java Integer decode() Method | This blog explains the decode method in the Java Integer class. This method decodes the string into an integer. Many times we use an integer as a string like (“ ”) there are scenarios where we have provided the integer value inside the double quotes, and the decode method decodes these strings as an integer. The decode method actually decodes the string data type into… Read more: Java Integer decode() Method
  • How To Compare String And Integer In Java
    How To Compare String And Integer In Java | We will discuss how to compare string and integer in Java. The integer is a wrapper class for an int primitive and the String class is given to store characters in Java. In order to compare two different types, we have to convert one of the types to another. For example, here we have to convert string to integer or integer… Read more: How To Compare String And Integer In Java
  • Integer.compare() in Java
    Integer.compare() in Java | In this blog, let us see about the compare method in the Integer wrapper class. Along with Integer.compare() method we will also see the compareTo() and compareUnsigned() methods. The compare() method compares two primitive int values and returns 0 if both the int value are equal, else if the first int value is lesser than the second int value then returns the value lesser than 0,… Read more: Integer.compare() in Java
  • Java Integer compareTo() Method
    Java Integer compareTo() Method | In this blog we discuss the pre-defined method compareTo() given in the wrapper class. The compareTo() method takes an integer argument to compare, if both are equal then it returns 0 else if the integer is greater than the argument integer then returns a value that is greater than 0 else if the integer is numerically lesser than the argument integer then it returns the value… Read more: Java Integer compareTo() Method
  • How To Reverse an Integer in Java
    How To Reverse An Integer In Java | In this blog, we will see how to reverse an integer value in Java programming language. We can develop our custom method or we can take the help of the pre-defined methods available in the Integer class. The reverse() method given in the Integer class is used to reverse an integer object by using the two’s complement in binary representation. But let… Read more: How To Reverse an Integer in Java
  • Java Convert Integer To Short and Vice-Versa
    Java Convert Integer To Short & Convert Short To Integer Java | In this blog, we will discuss how to convert the integer or int into a short data type or Short object and its reverse i.e. the short/Short into an Integer/int data type. The range of short data types is from -215 to 215-1 Or, -32768 to 32767 whereas the range of int data type is from -231 to 231-1 Or,… Read more: Java Convert Integer To Short and Vice-Versa
  • How To Reverse A Node Integer Linked List In Java
    How To Reverse A Node Integer Linked List In Java | Let us demonstrate how to reverse a linked list. Output:- The Linked list is:88 55 24 0After Reversing the linked list:0 24 55 88
  • Compare Integer And Int Java
    Compare Integer And Int Java | Here we see how to compare Integer and int in Java programming language. Both int and Integer seem the same but the main difference between them is int is a primitive data type whereas Integer is a Wrapper class. As int is a primitive data type it has less flexibility it can have only the binary value of an integer in it, but as… Read more: Compare Integer And Int Java
  • Convert Integer To Byte In Java
    Convert Integer To Byte In Java | In this blog, we will see how to convert the integer data type to byte data type. Both int and byte are primitive data types having wrapper classes Integer and Byte respectively, but the only difference is their capacity to hold the values. To convert Integer to Byte in Java we use three methods:-1. By using the type casting.3. By using Integer.byteValue() The… Read more: Convert Integer To Byte In Java
  • Java StringUtils substring() Method
    Java StringUtils substring() Method | In this blog, we study the substring method in the StringUtils class, this method returns the substring from the specified start and end index from the user. There are several variations in this method they are as follows:- 1) public static String substring(final String str, int start):- Gets a substring from the specified String avoiding exceptions.2) public static String substring(final String str, int start, int… Read more: Java StringUtils substring() Method
  • Java StringUtils repeat() Method
    Java StringUtils repeat() Method | In this blog, we will discuss the repeat() method given in the StringUtils class. This method is used to repeat the string or the character a specified number of times. Java StringUtils repeat() Method Syntax Java StringUtils repeat() method has the following three variations:- public static String repeat(final char ch, final int repeat):- Returns padding using the specified delimiter repeated to a given length. public… Read more: Java StringUtils repeat() Method
  • StringUtils startsWith() Example
    StringUtils startsWith() Example | In this blog, we will discuss the startsWith() method of StringUtils class of the Apache Common Lang package. This method returns the boolean value that is if the string starts with the given character or character sequence then it returns true, or else if it does not start with the given value then it returns false. Basically, the startsWith method is a string-handling method that helps… Read more: StringUtils startsWith() Example
  • StringUtils replaceEach() Example
    StringUtils replaceEach() Example | In this blog we will discuss the replaceEach() method of StringUtils class. This method is used to replace each of the characters present in the string. The question might arise what is the difference between replace() and replaceEach() method? The replace() method replaces all the occurrences of the given pattern provided the pattern should be in the same order as in the string and replace accepts… Read more: StringUtils replaceEach() Example
  • StringUtils leftPad() Example
    StringUtils leftPad() Example | In the StringUtils class, we have a method called leftPad() which is used to add whitespaces or given characters/strings to the left of the string. There are three different variations of this method as listed below. The syntax for the leftPad() method and its variations are as follows:- public static String leftPad(final String str, final int size) public static String leftPad(final String str, final int size,… Read more: StringUtils leftPad() Example
  • StringUtils defaultIfBlank() Method
    StringUtils defaultIfBlank() Method | The defaulIfBlank() method of StringUtils class returns the given set of strings if the passed string is null or else if the string is not null it returns the original string only. This is one of the best ways to replace the null string. StringUtils.defaultIfBlank() Method in Java The syntax for the method defalulIfBlank is as follows:public static T defaultIfBlank(final T str, final T defaultStr)It returns… Read more: StringUtils defaultIfBlank() Method
  • StringUtils capitalize() Method in Java
    StringUtils capitalize() Method in Java | In this blog, we will discuss how to capitalize the string by using built-in methods in StringUtils class. There is a method called capitalize() in StringUtils class which will capitalize only the first character in the string. StringUtils.capitalize() Method The syntax for the capitalize method is as follows:- public static String capitalize(final String str)It capitalizes a String changing the first character to the title… Read more: StringUtils capitalize() Method in Java
  • Java StringUtils split() Method
    Java StringUtils split() Method | In this blog, we will discuss the split() method in StringUtils class. The spit() method from StringUtils class takes two arguments one is a string which is needed to be split another one is the substring or a character which needs to be removed from the string. The split method returns the array of strings after the split is performed. The overloaded forms of the… Read more: Java StringUtils split() Method
  • StringUtils containsAny() Method
    StringUtils containsAny() Method | In this blog, we will discuss the containsAny() method of StringUtils class. The containsAny() method is used to check whether the given string is present in the substring or not. The contains() method of StringUtils class also does the same task but the difference is in the contains() method searches for the same pattern in the main string but for the containsAny() method the string need… Read more: StringUtils containsAny() Method
  • Java StringUtils contains() Method
    Java StringUtils contains() Method | In this blog, we see how to use StringUtils contains() method in Java. The contains() method checks whether the substring is contained in the main string or not. There are many variations of the StringUtils contains() method as listed below:- contains(CharSequence seq, CharSequence searchSeq) contains(CharSequence seq, int searchChar) containsAny(CharSequence cs, char… searchChars) containsAny(CharSequence cs, CharSequence… searchCharSequences) containsAny(CharSequence cs, CharSequence searchChars) containsAnyIgnoreCase(CharSequence cs, CharSequence… searchCharSequences) containsIgnoreCase(CharSequence… Read more: Java StringUtils contains() Method
  • Import StringUtils in Java
    Import StringUtils in Java | In this blog, we will study how to import the StringUtils class in Java. Importing this class is not relatively easy hence we have planned to make a blog so that it might be easy for the users to use StringUtils. The StringUtils class is part of the Apache Common Lang package but not the part of Java language package. Therefore to import and use… Read more: Import StringUtils in Java
  • How To Convert StringBuffer To String In Java
    How To Convert StringBuffer To String In Java? In this blog, we convert the StringBuffer to string in Java. There are built-in methods available to convert the StringBuffer to a string object. First, we see the toString() method which directly converts the StringBuffer to a string. String class also contains a constructor to create a String object from the StringBuffer class object. Also see:- Java String To StringBuffer How To… Read more: How To Convert StringBuffer To String In Java
  • Java String To StringBuffer
    Java String To StringBuffer | In this blog, we will convert the string to a StringBuffer. The StringBuffer is a class that is a synchronized and thread-safe model and method local operations because locking and unlocking objects is not necessary for StringBuffer. We use StringBuffer when we want to modify and store the object in a multi-threading environment, whereas we use the string when we don’t want to modify the… Read more: Java String To StringBuffer
  • Java StringBuffer reverse() Method
    Java StringBuffer reverse() Method | The reverse() method is a built-in method in the StringBuffer that is used to reverse each and every character in the StringBuffer object. This helps to reverse the characters in the string. The syntax for the reverse method is as follows:- public StringBuffer reverse()Parameters: there are no parameters accepted.Return type: stringReturns: the string which is reversed. An example of the reverse method is as follows:-Example-1:String:… Read more: Java StringBuffer reverse() Method
  • Java StringBuffer length() Method
    Java StringBuffer length() Method | The length() method of the StringBuffer class returns the number of characters in the StringBuffer object. We can directly obtain the length of the string without the StringBuffer class but it might create a new object hence it consumes more space and performance decreases. An example of the length method is as follows:-Example-1:-StringBuffer: “People”Length: 5Example-2:StringBuffer: “”Length: 0 StringBuffer length() Method in Java The syntax for… Read more: Java StringBuffer length() Method
  • StringUtils lowerCase() Method
    StringUtils lowerCase() Method | In this blog, we will discuss the lowerCase() method of the StringUtils class. It is a static method that converts the string to a lower case and if the string is null then this method returns null. There are two variations in the method one just accepts the string and the other accepts string and locale. StringUtils.lowerCase() Method The syntax for the lowerCase method is as follows:-… Read more: StringUtils lowerCase() Method
  • StringUtils isNumeric() Java
    StringUtils isNumeric() Java | The isNumeric() method is the static method in the StringUtils method that checks whether the string contains Unicode digits or not. This method returns false if the string has decimal values as decimal values are not considered Unicode digits and also it returns false if it contains null or the string is empty. Also see:- Unicode character set in Java Java StringUtils isNumeric() Method The syntax… Read more: StringUtils isNumeric() Java
  • StringUtils.rightPad() Method
    StringUtils.rightPad() Method | The rightPad() method is a static method in a StringUtils class that helps to add the pad spaces/character/string to the right side of the string. There are three variations in this method to right pad a string with space, character, and string. StringUtils rightPad() Method The syntax for the rightPad() method and its variations are as follows:- public static String rightPad(final String str, final int size):- Right… Read more: StringUtils.rightPad() Method
  • StringUtils.isNotEmpty() Method
    StringUtils.isNotEmpty() Method | In this blog, we will discuss the apache StringUtils isNotEmpty() method. This method is opposite to the StringUtils.isEmpty() method. In the isEmpty() method we find whether the given string is empty or not but in the isNotEmpty method we find the string is not empty or not. This method is present in the apache StringUtils class hence to use this method in our programs we need to… Read more: StringUtils.isNotEmpty() Method
  • StringUtils isEmpty() Vs isBlank()
    StringUtils isEmpty() Vs isBlank() | Both isEmpty() and isBlank() are present in StringUtils class, these methods are used to find whether the string is empty or not. Even though they perform the same task but are some differences between them. In this blog, we will discuss the differences between StringUtils isEmpty() Vs isBlank() method. StringUtils isBlank() vs isEmpty() Method Signature The main difference:- The isBlank() method returns true if the… Read more: StringUtils isEmpty() Vs isBlank()
  • StringUtils equals() Method
    StringUtils equals() Method | In this blog, we will discuss the equals() method of the StringUtils class. The StringUtils.equals() method compares the two different strings and evaluates whether they are equal or not. The StringUtils.equals() method returns true if the strings are equal or else it returns false. The return type of the equals method is boolean. Java StringUtils equals() Method The syntax for the equals method is as follows:-public… Read more: StringUtils equals() Method
  • StringUtils isNotBlank() Method
    StringUtils isNotBlank() Method | The isNotBlank() method in the StringUtils is used to check whether the string is not blank or not. It is just the opposite of StringUtils.isBlank() method where the isBlank() method checks if the string is empty or not but the isNotBlank() checks if the string is not empty or not. If the string is empty then isNotBlank() method returns false or else if the string is… Read more: StringUtils isNotBlank() Method
  • StringUtils isEmpty() Method
    StringUtils isEmpty() Method | In this blog, we will discuss the isEmpty() method, which is the static method present in the StringUtils class. We can use this method to check whether the string is empty or not. We consider the string is empty only when it satisfies the below criteria:-  If the size or length of the string is zero. If the string points to a null reference. Java StringUtils… Read more: StringUtils isEmpty() Method
  • Java StringBuffer insert() Method
    Java StringBuffer insert() Method | The insert() method in the StringBuffer class is used to insert the given character or the string at the said index. There are many variations of the insert() method:- All of the above insert() method throws StringIndexOutOfBoundsException. As we know StringBuffer class is synchronized and all its methods are also synchronized. But in the above list of insert() methods, some method doesn’t contain the synchronized… Read more: Java StringBuffer insert() Method
  • StringUtils isBlank() Method
    StringUtils isBlank() Method of Apache Commons Lang package | In this blog, we will discuss the isBlank() method of the StringUtils class of Apache Commons Lang package. The isBlank() method is used to check whether the given string is blank or not. The given string is blank when it has zero characters, when the string points to the null, or when the string contains the whitespace characters. Java StringUtils isBlank()… Read more: StringUtils isBlank() Method
  • Java StringBuffer append() Method
    Java StringBuffer append() Method | In this blog, we will discuss the append() method given in the StringBuffer class. The append() method appends two or more strings. The append() method of the StringBuffer class is very similar to the StringBuilder class append() method. The append() method of the StringBuffer class has the following different variations:- public synchronized StringBuffer append(String str) public synchronized StringBuffer append(Object obj) public synchronized StringBuffer append(StringBuffer sb)… Read more: Java StringBuffer append() Method
  • When To Use StringBuffer And StringBuilder In Java
    When To Use StringBuffer And StringBuilder In Java? Here we will discuss the difference between StringBuffer And StringBuilder class. As we all know both are string manipulation classes but what might be the difference between and when to use which one of them? This blog will answer all those questions. First, we will see the background of these two classes. First of all, let us know what is mutable and… Read more: When To Use StringBuffer And StringBuilder In Java
  • String To StringBuilder Java
    String To StringBuilder Java | In this post, we will discuss how to convert string to StringBuilder. Previously we have seen how to convert StringBuilder to String using the toString() method and String class constructor. The StringBuilder class allows us to modify the string literal without creating a new StringBuilder object. And StringBuilder class also contains some string manipulating methods that which String class doesn’t have like the reverse() method.… Read more: String To StringBuilder Java

Leave a Comment

Your email address will not be published. Required fields are marked *