Computers and Technology
Computers and Technology, 30.05.2020 16:58, kingzae04

Write a class called DisArray with methods to convert a 1-dimensional array to a 2-dimensional array. The methods' name should be convert2D. You should create methods to convert int[] and String[], that can be tested against the following class. Your convert2D methods should choose the closest possible square-ish size for the 2D array. For example, if your input array is [10], its 2D conversion should be [3][4] or [4][3] -- you decide if you want to favor rows over columns. Your method should place the elements of the one-dimensional array into the two-dimensional array in row-major order, and fill the remaining elements with 0 (for integer arrays) or null (for String arrays). The process of filling unused elements with 0 or null is called padding. If the input array's length is a perfect square, e. g., [16], then your output should a square array, i. e., [4][4]. For any other size, your objective is to minimize the number of padded elements. For example, if your input is [10] you should opt for a [3][4] array instead of a [4][4]. The former will have only 2 padded elements; the latter 6.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 09:00, breella0
Howard is designing a chair swing ride. the swing ropes are 5 meters long, and in full swing they tilt in an angle of 29° outside chairs to be 2.75 m above the ground in full swing.
Answers: 1
image
Computers and Technology, 23.06.2019 09:30, kreshnikolloma
You wanted to look up information about alzheimer's, but you were unsure if it was spelled "alsheimer's" or "alzheimer's." which advanced search strategy would be useful? a) a boolean search b) using a wild card in your search c) trying different search engines d) doing a search for "alsheimer's not alzheimer's" asap. ill give brainlist.
Answers: 1
image
Computers and Technology, 23.06.2019 17:00, chrisgaz14
The more powerful, 60 volt cables and the main power shut off on an hev are both colored orange
Answers: 1
image
Computers and Technology, 24.06.2019 00:30, bsonicx
The best definition of an idiom is a. a word or phrase that describes a noun b. a word or phrase describing a verb c. a phrase containing figurative language in which the word expresses a different idea from its exact meaning d. a phrase that compares two unlike objects or ideas
Answers: 2
Do you know the correct answer?
Write a class called DisArray with methods to convert a 1-dimensional array to a 2-dimensional array...

Questions in other subjects: