How to use java to realize LCD Digital Font display current time
This article is about how to use java to display the current time in LCD digital fonts. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The details are as follows
Import java.text.SimpleDateFormat; import java.util.Date Public class TestTime {public static String [] [] num0 = new String [] [] {{","-","}, {"|", ","}, {"}, {", "}, {" | ",", "| {", ","} Public static String [] [] num1 = new String [] [] {{",", "}, {", "|", ","} Public static String [] [] num2 = new String [] [] {{","-","}, {"," | ", {", "-", "}, {" | ",", "}, {", ","} Public static String [] [] num3 = new String [] [] {{","-","}, {"," | ", {", "-", "}, {", "|", {",", "}} Public static String [] [] num4 = new String [] [] {{","}, {"|", "," | ", {", "-", "}, {", "|", {",", "} Public static String [] [] num5 = new String [] [] {{","-","}, {" | ",", "}, {", "-", "}, {", "|", {",", "}} Public static String [] [] num6 = new String [] [] {{","-","}, {" | ",", "}, {", "-", ""}, {"|", "," | "}, {", ","} Public static String [] [] num7 = new String [] [] {{","-","}, {"," | ", {", ","}, {",", "|"}, {",", "} Public static String [] [] num8 = new String [] [] {{","-","}, {"|", ","}, {","}, {"|", "," | ", {", ","} Public static String [] [] num9 = new String [] [] {{","-","}, {"|", "," | ", {", "-", "}, {", "|", {",", "} Public static String [] [] option = new String [] [] {{",", "}, {", "●", ""}, {",", "}, {", "●", ""}, {",", "} Public static String [] numAll = new String [] {num0, num1, num2, num3, num4, num5, num6, num7, num8, num9}; public static SimpleDateFormat sdf = new SimpleDateFormat ("HH:mm"); public static void main (String [] args) {print ();} public static void print () {String [] newStr = getDateArray (); for (int I = 0; I < 5; iSuppli +) {for (int k = 0) K < newStr.length; knot +) {for (int j = 0; j < 3; jacks +) {System.out.print (newStrk] [I] [j]);} System.out.print (");} System.out.println ();}} public static String [] getDateArray () {String [] dateArray = new String [5] [] [] String dateStr = sdf.format (new Date ()); char [] dateChars = dateStr.toCharArray (); for (int I = 0; I < dateChars.length; iTunes +) {switch (dateChars [I]) {case':': dateArray [I] = option; break; default: dateArray [I] = numAll [Integer.valueOf (String.valueOf (datechars [I])]; break }} return dateArray;}} Thank you for your reading! On "how to use java to achieve LCD digital font display current time" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!