Java table example
public class Main { public static void main(String[] args) { for (int y = 2; y < 13; y++) { for (int x = 1; x < 13; x++) { System.out.println(y+" X "+x+" = "+x*y); } System.out.println(); } } }
Arrays example:
import java.util.*; class MyProgram { public static void main(String[] args){ int[] my_array = {1,2,3,4,5}; Hashtable my_ht = new Hashtable(); my_ht.put("name", "Alex Merced"); my_ht.put("age", "35"); System.out.println(my_array); System.out.println(my_ht); } }
Display html from another site
import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.web.WebEngine; import javafx.scene.web.WebView; import javafx.stage.Stage; public class DisplayHTMLFromWebsite extends Application { @Override public void start(Stage primaryStage) { // Create a WebView and a WebEngine WebView webView = new WebView(); WebEngine webEngine = webView.getEngine(); // Load a website URL String websiteURL = "https://www.example.com"; webEngine.load(websiteURL); // Create the scene Scene scene = new Scene(webView, 800, 600); // Set up the stage primaryStage.setTitle("Display HTML from Website"); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } }
MD5 decoder
import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class MD5Decoder { public static String calculateMD5(String input) { try { // Get an instance of the MD5 message digest algorithm MessageDigest md = MessageDigest.getInstance("MD5"); // Update the digest with the bytes of the string md.update(input.getBytes()); // Get the hash bytes byte[] digest = md.digest(); // Convert the bytes to a hexadecimal string StringBuilder result = new StringBuilder(); for (byte b : digest) { result.append(String.format("%02x", b)); } return result.toString(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return null; } } public static void main(String[] args) { String inputString = "HelloWorld"; // Calculate the MD5 hash of the input string String md5Hash = calculateMD5(inputString); // Display the MD5 hash System.out.println("MD5 Hash: " + md5Hash); } }