diff --git a/src/Palette.java b/src/Palette.java index 2a1167fb2ee80c4015c188aca0b0495ec7a78562..9dbc8e0b114b9fb9a9ada27c1c070483e5756d0f 100644 --- a/src/Palette.java +++ b/src/Palette.java @@ -17,15 +17,13 @@ public class Palette extends HttpServlet out.println("<center>Palette<table>"); - final String HEX = "0123456789abcdef"; - - for (int x = 0; x < HEX.length(); ++x) { + for (int x = 0; x < 16; ++x) { out.println("<tr>"); - for (int y = 0; y < HEX.length(); ++y) { - char blue = HEX.charAt(x); - char green = HEX.charAt(y); - out.println(String.format("<td style=\"width: 1em;height:1em;background: #0%c%c\"></td>", green, blue)); + for (int y = 0; y < 16; ++y) { + String blue = Integer.toHexString(x); + String green = Integer.toHexString(y); + out.println(String.format("<td style=\"width: 1em;height:1em;background: #0%s%s\"></td>", green, blue)); } out.println("</tr></center>");