Posts by Author : tgugnani

Java

Jun 1, 2017

tgugnani

To get the Random int values we utilise the java.util.Math provided under java library. Since Math.random()returns random double value between 0 and 1 , we multiply it by 100 to get random numbers bet...
Read Article

Java

May 29, 2017

tgugnani

1. Using Custom Method   import java.util.Arrays; public class ArrayCopy { public static void main(String args[]) { String[] myStringArray = { "Alice", "Bob", "Tim", "John",...
Read Article

Java

May 29, 2017

tgugnani

public class ArraySecondHighest { public static void main(String args[]) { int[] myIntArray = { 12, 13, 14, 15, 16, 89, 23, 1, 90, 100 }; Arrays.sort(myIntArray); Sys...
Read Article

Java

May 29, 2017

tgugnani

Although there are inbuilt method in the commons.lang library using which we can remove the element in array with just a single statement , we will first approach this using a custom method to see how...
Read Article

Java

May 29, 2017

tgugnani

1. Using Custom Method Following is the Java code to reverse the elements of an array by writing a self custom method. import java.util.Arrays; public class ArrayReverse { public static vo...
Read Article

Java

May 29, 2017

tgugnani

Using custom method Following is the Java code to check if your array contains any specific element. public class ArrayContains { public static void main(String args[]){ i...
Read Article

Java

May 28, 2017

tgugnani

Following is the code to calculate the Average of elements in the Array. import java.util.Scanner; public class ArrayChallange { public static Scanner scanner= new Scanner(System.in);...
Read Article

Java

May 27, 2017

tgugnani

Following is the code to sort an int Array in Java in decreasing order. That means the highest will appear first and the smallest will be in last. package info.FiveBalloons.Examples; import java.u...
Read Article

Java

May 27, 2017

tgugnani

Primitive data type in Java can only store a single value of a particular type. Arrays are used to store multiple values of a similar type into a single variable. Let's straight away see an example of...
Read Article

Java

May 27, 2017

tgugnani

Fibonacci Series are number series in which next number is the sum of previous two numbers. For example, if we consider our first two numbers as 0 and 1, then our fibonacci series will look like. 0 1...
Read Article