Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialkimberli Broadus
3,197 PointsHow to write an application that allows you to initialize and fill in a one-dimensional array of 12 double numbers?
Create and use the custom method to sort the array values in a descending order.
1 Answer
jcorum
71,830 PointsNot sure if this is what you are looking for, as you didn't mention the source of the doubles to put in the array. But it does initialize a 1-dimensional array and fill it will 12 doubles.
double[] source = {2.3, 4.5, 6.7, 8.9, 1.2, 1.4, 2.4, 2.6, 3.9, 6.3, 7.4, 8.5};
double[] doubleArray = new double[12];
for (int i = 0; i < 12; i++) {
doubleArray[i] = source[i];
}