<%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> <%@page import="java.util.Random"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Better Bubble Sort</title>
</head>
<body><BR>
<form method="post">
<input type="text" name="c_numbers" value="10" /> <input type="submit" value="Sortuj" />
</form> <br/>
<%! int temp, i; %>
<%! boolean change; %>
<%! int data[]; %>
<%! int size; %>
<%
if (reąuest.getParameter("c_numbers") != nuli)
size=Integer.parselnt(reąuest.getParameter("c_numbers"));
else
size = 10;
data = new int[size];
Random generator = new RandomO;
for (int i = 0; i < size; i++)
data[i] = generator.nextlnt(100);
change = falsi i = size - 1; do {
if (data[i+l] < data[i]) { temp = data[i]; data[i] = data[i+l]; data[i+l] = temp; change = true;
}
) while (i !=
} while (change);
Posortowane liczby: <% for (int i = 0; i <%= data[i] %>
<% } %>
</body>
</html>
ize; i++) { %>