Binary search on a double array can be implemented by using the methodjava.util.Arrays.binarySearch(). This method returns the index of the required double element if it is available in the array, otherwise it returns (-(insertion point) - 1) where the insertion point is the position at which the element would be inserted into the array.A program that demonstrates this is given as follows −Example Live Demoimport java.util.Arrays; public class Demo { public static void main(String[] args) { double d_arr[] = { 5.2, 7.5, 9.7, 1.8, 4.0 }; Arrays.sort(d_arr); System.out.print("The sorted array is: ... Read More
To implement animation on the transform-origin property with CSS, you can try to run the following codeExampleLive Demo #demo1 { position: relative; height: 300px; width: 400px; border: 2px solid black; margin: 100px; padding: 5px; } #demo2 { padding: 30px; position: absolute; border: 1px solid black; background-color: orange; transform: rotate(45deg); transform-origin: 30% 10%; animation: mymove 3s infinite; } @keyframes mymove { 30% { transform-origin: 0 0 0; } } CSS transform-origin property Demo
The CSS rest-after property is useful for speech media to set pause before an element.Let us see an example of rest-before speech media propertyh1 { rest-before: 15ms; }The time sets the pause in milliseconds.
One of the methods in the Timer class is the void schedule(TimerTask task, long delay, long period) method. This method schedules tasks for repeated fixed-delay execution, beginning after the specified delay.In fixed-delay execution, each execution is scheduled with respect to the original execution time of the preceding execution. If an execution is delayed for a particular reason (case in point, garbage collection), the subsequent executions will be delayed as well.Declaration −The java.util.Timer.schedule(TimerTask task, long delay, long period) is declared as follows −public void schedule(TimerTask task, long delay, long period)Here, task is the task to be scheduled, delay is the delay ... Read More
To implement animation on min-height property with CSS, you can try to run the following codeExampleLive Demo div { overflow: auto; width: 350px; background-color: blue; color: white; border: 1px solid black; animation: myanim 3s infinite; } @keyframes myanim { ... Read More
The voice-duration property in CSS is used where synchronization of speech is done with other media.The following is an example to implement the voice-duration speech media propertyp { voice-duration: 5s; }Above you can set auto value also.The auto value rectify a used value corresponding to the duration of the speech synthesis when using the inherited voice-rate. This is when you use inherited voice-rate.
Use the voice-balance property to set whether the spoken voice is from the left or right, etc.The following is a syntax to set the volume from left or right or centervoice-balance: left | center | rightLet us see an example to implement the voice-balance speech media propertyp { voice-balance: right; }
An array can be easily printed by using the method java.util.Arrays.toString() in Java. This method returns a string representation of the array contents that is enclosed in square brackets. If the array is null, then this method returns null.A program that demonstrates this is given as follows −Example Live Demoimport java.util.Arrays; public class Demo { public static void main(String args[]) { String str[] = {"John", "Harry", "Sally", "Emma", "Peter"}; System.out.println("The array content is:"); System.out.println(Arrays.toString(str)); } }OutputThe array content is: [John, Harry, Sally, Emma, Peter]Now let us understand the above program.The ... Read More
To implement animation on max-width property with CSS, you can try to run the following codeExampleLive Demo div { overflow: auto; background-color: blue; color: white; border: 1px solid black; animation: myanim 3s; } @keyframes myanim { 30% { ... Read More
The LinkedList class extends AbstractSequentialList and implements the List interface. It provides a linked-list data structure.Following are the constructors supported by the LinkedList class.Sr.No.Constructor & Description1LinkedList( )This constructor builds an empty linked list.2LinkedList(Collection c)This constructor builds a linked list that is initialized with the elements of the collection c.Apart from the methods inherited from its parent classes, LinkedList defines following methods.Sr.No.Method & Description1void add(int index, Object element)Inserts the specified element at the specified position index in this list. Throws IndexOutOfBoundsException if the specified index is out of range (index < 0 || index > size()).2boolean add(Object o)Appends the specified element ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP