Print ASCII code using Java outputstream

Source: Internet
Author: User

Import Java.io.fileoutputstream;import java.io.ioexception;import java.io.outputstream;/** * Print ASCII table to file * @author ZZW922CN * */public class Printascii {public static void main (string[] args) throws IOException {//TODO auto-generated Me Thod stub//defines the output stream outputstream FileOutputStream = new FileOutputStream ("1.txt"),//ascii characters from 33 to 126 can print int start=33; int end=126;int total=94;int s=start;int real;int count=0;while (count<94) {for (int i=s;i<s+total;i++) {real= (i <=end)? I: (i% (end+1) +start); Fileoutputstream.write (real);} Fileoutputstream.write (+); Fileoutputstream.write (ten); s++;count++;} Turn off the output stream fileoutputstream.close (); System.out.println ("Print successfully!");}}


The output is:

!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~ "#$%&" () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!#$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" $%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$% ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ') *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' (*+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () +,-./0123456789:;< =>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-/0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-. 0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./023456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./013456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./012456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./012356789:;<=>[email protected]ijKlmnopqrstuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./012346789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./012345789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./012345689:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./012345679:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./012345678:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=> @ABCDEFGHIJKLMNOPQRSTUVWXYZ [\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>? Abcdefghijklmnopqrstuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]bcdefghijklmnopqrstuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]cdefghijklmnopqrstuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]defghijklmnopqrstuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]efghijklmnopqrstuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]fghijklmnopqrstuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]ghijklmnopqrstuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email proTected]hijklmnopqrstuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]ijklmnopqrstuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz {|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]jklmnopqrstuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{ |} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]klmnopqrstuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]lmnopqrstuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]mnopqrstuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]nopqrstuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]opqrstuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]pqrstuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;&LT;=&GT [Email protected] Qrstuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]rstuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]stuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]tuvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]uvwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]vwxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]wxyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]xyz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]yz[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]z[\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected]\]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][]^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][^_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]_ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^ ' abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_abcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' bcdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' acdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abdefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;&LT;=>[email protected][\]^_ ' abcefghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdfghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdeghijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefhijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefgijklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghjklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghiklmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijlmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijkmnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklnopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmopqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnpqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnoqrstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnoprstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqstuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrtuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrsuvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstvwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuwxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvxyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' Abcdefghijklmnopqrstuvwyz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxz{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxy{|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz|} ~!" #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{}~! ' #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|~! ' #$%& ' () *+,-./0123456789:;<=>[email protected][\]^_ ' abcdefghijklmnopqrstuvwxyz{|}



Print ASCII code using Java outputstream

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.