Write a JAVA program to sort a given array of integers (1 Dimensional) in ascending order (from smallest to largest). You can either get the array as input or hardcode it inside your program.

Answers

Answer 1
Answer:

Answer:

import java.util.Arrays;

public class sort{

    public static void main(String []args){

       int[] arr = {2,6,9,1,5,3};

       int n = arr.length;

       Arrays.sort(arr);

       for(int i=0;i<n;i++){

          System.out.println(arr[i]);

       }    

    }

}

Explanation:

first import the library Arrays for using inbuilt functions.

create the main function and define the array with elements.

then, use the inbuilt sort function in java which sort the array in ascending order.

syntax:

Arrays.sort(array_name);

then, use for loop for printing the each sorting element on the screen.


Related Questions

Create an application named TestSoccerPlayer that instantiates and displays a SoccerPlayer object. The SoccerPlayer class contains the following properties: Name - The player’s name ( a string) JerseyNum - The player's jersey number (an integer) Goals - Number of goals scored (an integer) Assists - Number of assists (an integer)
Susan is taking a French class in college and has been asked to create a publication for her class. What feature can sheuse to help her develop her publication in French?ResearchGrammarLanguageSpell Check
Is there a point where preto distribution really takes over?
what would be the address of the cell, which is intersect of the second row and third column in a worksheet
Most networking media send data using _____ in which data is represented by only two discrete states: 0s and 1s.A. digital signalsB. contiguous signalsC. ramp signalsD. exponential signals

Express 278910 in binary – Use the technique of subtracting powers of 2

Answers

Answer: The decimal number 278910, expressed in binary, is as follows:

               1000100000101111110

Explanation:

Any decimal number can be expressed as a linear combination of powers of 2, as follows:

N = aₙ* 2ⁿ +.....+ a₀*2⁰, where the coefficients aₓ can be 0 or 1.

This means that any number, can be decomposed in powers of 2, so a useful and at the same time simple way to find the binary equivalent of a decimal number, is simply to substract from the number the maximum power of 2 that gives a positive outcome, and put a "1" in the most left position, filling with zeros to the right till finding the following power of two (obtained repeating the process with the result from the first substraction).

For the first substraction, we try different choices, until we get a positive result substracting 2¹⁸ from 278910, as follows:

278,910-262,144= 16,766.

Intuitively, we know that as being 16 a power of 2, it's possible that a number close to the one we have as a result, be a power of 2 indeed.

Trying with 2¹⁴, we find that we are right, because the result is a small number:  

16,766 - 16,384 = 382

Now. it's very easy, as the greatest power of 2 smaller than 382, is 2⁸=256.  

382-256= 126.

126 can be written as 64+32+16+8+4+2, so all that we need now is, going from left to right, put "1", as the coefficient of the powers of 2 18, 14, 8, 6, 5,4,3,2 and 1, filling with zeros the remaining ones.

The final number can be written as follows:

1000100000101111110

_________ is a business strategy in which a company purchases its upstream suppliers to ensure that its essential supplies are available as soon as the company needs them.The bullwhip effect

Vertical integration

JIT

VMI

Answers

Answer:

Vertical Integration

Explanation:

Vertical Integration is a business strategy in which a company purchases its upstream suppliers to ensure that its essential supplies are available as soon as the company needs them.  This enables the business to exercise higher control over supply related uncertainties and to optimize supplies based on changing demand or business priorities.

An example can be a textile manufacturer purchasing a dye manufacturing unit.

A mobile device user is having problems launching apps and texting. The user touches an app to launch it, but the app icon next to the desired app launches instead. When the user types a text message, every word in the message is misspelled. What is the most likely cause for this behavior?

Answers

Answer:

The screen protector may be interfering with the touch response

Explanation:

Screen protectors or commonly called screen guards are used to protect phone screens. In case they fall to the ground, these protectors act as shields to keep the phone screen from getting damaged. However screen protectors if not positioned or fixed properly may also cause hindrance to effective touch response as they become barriers to the touch screen.

Once a device has failed, what metric measures the average amount of time to repair?a.
mean field replacement time (MFRT)
b.
mean time to repair (MTTR)
c.
mean time to restore (MTTR)
d.
mean restoration time (MRT)

Answers

Answer:b) Mean time to repair (MTTR)

Explanation:- Mean time to repair (MTTR) is the average time that is defined for the repairing of the of any failure or damage that has occurred.  Mean time to repair gives idea about the maintenance of the elements that can be repaired. It holds the responsibility of the reverting about the repair speed of the item. Therefore, the correct option is option(b).

What is not an operating system

Answers

The answer is MS-Word

. A file allocation table (FAT) is used to keep track of the portions assigned to a file. Select one: True False

Answers

Answer: True

Explanation: File allocation table(FAT) is the part of the file system that helps the hard drives .It is used for the management of the files and data which gets stored in the hard drive  by the operating system. It can also help in the extension or expansion of the hard drive storage.

It also keeps tracing the files and data accordingly. This table works for the  portable devices ,cameras etc. Thus, the statement given is true.