|
Java Source Code Formatting Show |
|
| |
|
|
SourceFormatX code formatter bases on powerful syntax parse engines so it can beautify and format source code files with omnifarious styles, even these messy source code examples below:
|
Java Source Code Formatting Examples:
Example 1
|
Example 2
|
Example 3
|
Example 4
This is an extreme java code formatting example, the purpose of it is to show the power of Java syntax parse engine powered by SourceFormatX Java Code Formatting Tool.
package cryptix.examples;import java.io.FileInputStream;import
java.io.IOException;import cryptix.security.MD5;
/** This is a demo of how to use the MD5 or SHA1 classes for hashing data **/
public final class MD5AFile{private static final int BUF_LENGTH=1024;public
static void main(String argv[]){if(argv.length!=1)System.err.println(
"usage java MD5Afile filename");else try{printHash(doHash(argv[0]));}catch(
IOException ioe){System.err.println(
"There has been an IO exception to the file was not hashed.");
ioe.printStackTrace();}}private static void printHash(byte buf[]){
System.out.println("hash of file is;");System.out.print("MD5 : ");for(int i=0,j
=buf.length;j>0;i++,j--){int val=(int)buf[i];System.out.print(Integer.toString(
(val>>4)&0xF,16));System.out.print(Integer.toString(val&0xF,16));}
System.out.println();}}
package cryptix.examples;
import java.io.FileInputStream;
import java.io.IOException;
import cryptix.security.MD5;
/** This is a demo of how to use the MD5 or SHA1 classes for hashing data **/
public final class MD5AFile
{
private static final int BUF_LENGTH = 1024;
public static void main(String argv[])
{
if (argv.length != 1)
System.err.println("usage java MD5Afile filename");
else
try
{
printHash(doHash(argv[0]));
}
catch (IOException ioe)
{
System.err.println(
"There has been an IO exception to the file was not hashed.");
ioe.printStackTrace();
}
}
private static void printHash(byte buf[])
{
System.out.println("hash of file is;");
System.out.print("MD5 : ");
for (int i = 0, j = buf.length; j > 0; i++, j--)
{
int val = (int)buf[i];
System.out.print(Integer.toString((val >> 4) & 0xF, 16));
System.out.print(Integer.toString(val & 0xF, 16));
}
System.out.println();
}
}
Example 1
|
Example 2
|
Example 3
|
Example 4
Don't waste time on formatting Java code by hand any more! Use SourceFormatX Java Code Formatter to format your Java code.
|