Loading...
Processing Forum
Recent Topics
All Forums
Move this topic
Forum :
Share your Work
Programming Questions
Core Library Questions
Contributed Library Questions
Android Processing
Processing with Other Languages
Integration and Hardware
Library and Tool Development
Events and Opportunities
General Discussion
Sub forum :
Move this topic
Cancel
General Discussion
Other
orhunkupe..
How can I sort an array in ascending order
in
General Discussion
•
Other
•
1 year ago
I want to define an array and sort it in ascending order can someone help me ?
Thanks.
1
Replies(1)
benja
Re: How can I sort an array in ascending order
1 year ago
You can use Arrays.sort() for this. Here is an example:
// define array
float[] myArray = new float[10];
// fill array with random values
for(int i = 0; i < myArray.length; i++){
myArray[i] = random(10);
}
println("initial array:");
println(myArray);
Arrays.sort(myArray);
println("ascending order:");
println(myArray);
Leave a comment on benja's reply
Change topic type
Topic Type :
Discussions
Questions
No of days :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Change topic type
Cancel
Link this topic
Provide the permalink of a topic that is related to this topic
Permalink
Save
Close
Reply to orhunkupeli7's question
Top
Reply
{"z20521894":[25080000001752011],"z22080828":[25080000001751158]}
Statistics
1
Replies
330
Views
0
Followers
Tags
No tags available for this topic.
Cancel
Actions
Permalink
Related Posts
[Solved] Temporary variables
is ArrayList faster than array ?
calling on classes to recognize an ...
Array intersect question
Question regarding image arrays.