FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaRepository/Boris/src/laba13/TurnOutMassive.java at master · karzhouAndrew/JavaRepository · GitHub
karzhouAndrew
/
JavaRepository
Public
Notifications
You must be signed in to change notification settings
Fork
16
Star
0
Code
Issues
0
Pull requests
96
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaRepository
/
Boris
/
src
/
laba13
/
TurnOutMassive.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
29 lines (25 loc) · 931 Bytes
Breadcrumbs
JavaRepository
/
Boris
/
src
/
laba13
/
TurnOutMassive.java
Copy path
File metadata and controls
29 lines (25 loc) · 931 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
package
laba13
;
//Create massive and fill it random numbers. Turn over massive.
import
java
.
util
.
Arrays
;
import
java
.
util
.
Random
;
public
class
TurnOutMassive
{
public
static
void
main
(
String
[]
args
) {
Random
rand
=
new
Random
();
int
lengthMassive
=
9
;
int
[]
arrayStraight
=
new
int
[
lengthMassive
];
for
(
int
i
=
0
;
i
<
arrayStraight
.
length
;
i
++) {
arrayStraight
[
i
] =
rand
.
nextInt
(
101
);
}
System
.
out
.
println
(
Arrays
.
toString
(
arrayStraight
));
for
(
int
i
=
0
;
i
<
arrayStraight
.
length
/
2
;
i
++) {
swap
(
arrayStraight
,
i
);
}
System
.
out
.
println
(
Arrays
.
toString
(
arrayStraight
));
}
private
static
void
swap
(
int
[]
arrayStraight
,
int
i
) {
int
temp
;
temp
=
arrayStraight
[
i
];
arrayStraight
[
i
] =
arrayStraight
[
arrayStraight
.
length
-
1
-
i
];
arrayStraight
[
arrayStraight
.
length
-
1
-
i
] =
temp
;
}
}
Back
|
FazBrowse Home
|
New Git URL