83 lines
4.2 KiB
HTML
83 lines
4.2 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>Question1.java</title>
|
||
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||
|
<style type="text/css">
|
||
|
<!--
|
||
|
body {color: #000000; background-color: #ffffff; font-family: monospace}
|
||
|
pre {color: #000000; background-color: #ffffff; font-family: monospace}
|
||
|
table {color: #404040; background-color: #e9e8e2; font-family: monospace}
|
||
|
.ST1 {color: #969696; font-family: monospace; font-weight: bold}
|
||
|
.ST2 {font-family: monospace; font-weight: bold}
|
||
|
.comment {color: #969696}
|
||
|
.ST3 {font-family: monospace; font-weight: bold; font-style: italic}
|
||
|
.ST6 {font-family: monospace; font-style: italic}
|
||
|
.ST5 {color: #ce54b8; font-family: monospace; font-style: italic}
|
||
|
.ST0 {color: #287bde}
|
||
|
.ST4 {color: #ce54b8}
|
||
|
.string {color: #1e9347}
|
||
|
.literal {color: #336bdd}
|
||
|
-->
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<table width="100%"><tr><td align="center">C:\Users\ar114\Documents\NetBeansProjects\Exam1_CalebFontenot\src\main\java\com\calebfontenot\exam1_calebfontenot\Question1.java</td></tr></table>
|
||
|
<pre>
|
||
|
<span class="comment">/*</span>
|
||
|
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
|
||
|
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java</span><span class="comment"> to edit this template</span>
|
||
|
<span class="comment"> */</span>
|
||
|
<span class="literal">package</span> com.calebfontenot.exam1_calebfontenot;
|
||
|
|
||
|
<span class="comment">/**</span>
|
||
|
<span class="comment"> *</span>
|
||
|
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">ar114</span>
|
||
|
<span class="comment">*/</span>
|
||
|
<span class="literal">public</span> <span class="literal">class</span> <span class="ST2">Question1</span> {
|
||
|
|
||
|
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST3">sort</span>(<span class="literal">int</span>[] arr) {
|
||
|
<span class="literal">for</span> (<span class="literal">int</span> i = 0; i < arr.<span class="ST4">length</span> - 1; ++i) {
|
||
|
<span class="literal">for</span> (<span class="literal">int</span> j = i + 1; j < arr.<span class="ST4">length</span>; ++j) {
|
||
|
<span class="literal">if</span> (arr[i] > arr[j]) {
|
||
|
<span class="literal">int</span> temp = arr[i];
|
||
|
arr[i] = arr[j];
|
||
|
arr[j] = temp;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST3">print</span>(<span class="literal">int</span>[][][] arr) {
|
||
|
<span class="literal">for</span> (<span class="literal">int</span> i = 0; i < arr.<span class="ST4">length</span>; ++i) {
|
||
|
<span class="literal">for</span> (<span class="literal">int</span> j = 0; j < arr[i].<span class="ST4">length</span>; ++j) {
|
||
|
<span class="literal">for</span> (<span class="literal">int</span> k = 0; k < arr[i][j].<span class="ST4">length</span>; ++k) {
|
||
|
System.<span class="ST5">out</span>.print(arr[i][j][k] + <span class="string">"</span> <span class="string">"</span>);
|
||
|
}
|
||
|
System.<span class="ST5">out</span>.println();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST3">main</span>(String[] args) {
|
||
|
<span class="literal">int</span>[][][] arr = {
|
||
|
{
|
||
|
{11, 2, 6, 22}, {3, 90, 112, 40, 7, 12}
|
||
|
},
|
||
|
{
|
||
|
{10, -20, 3}, {300, 50}
|
||
|
}
|
||
|
|
||
|
};
|
||
|
<span class="literal">for</span> (<span class="literal">int</span> i = 0; i < arr.<span class="ST4">length</span>; ++i) {
|
||
|
<span class="literal">for</span> (<span class="literal">int</span> j = 0; j < arr[i].<span class="ST4">length</span>; ++j) {
|
||
|
<span class="ST6">sort</span>(arr[i][j]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
<span class="ST6">print</span>(arr);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
</pre></body>
|
||
|
</html>
|