java arrays example

Get hashcode with hashCode()

About Hashcode Generally, a programmer writes a lengthy for loop to compare two strings for their equality, checking each character in both the strings. It is a time consuming process and performance goes down especially when the strings are lengthy. To overcome this, Java designers introduced hash code. It is…

Printing array elements with toString()

Arrays.toString() method makes it easier to print the elements of an array, forgetting the tedious iteration with for loops. Following is the method signature static String toString(int array1[]): Returns the array in string form useful to be displayed in a text field. This display the array elements comma-separated and placed…