Skip to content

Instantly share code, notes, and snippets.

@luisenriquecorona
Created April 17, 2019 23:48
Show Gist options
  • Save luisenriquecorona/dc4b178dd4edcd20550947819d55629d to your computer and use it in GitHub Desktop.
Save luisenriquecorona/dc4b178dd4edcd20550947819d55629d to your computer and use it in GitHub Desktop.
CheckSum one file, given an open BufferedReader.
/** CheckSum one file, given an open BufferedReader. */
public int process(BufferedReader is) {
int sum = 0;
try {
String inputLine;
while ((inputLine = is.readLine( )) != null) {
int i;
for (i=0; i<inputLine.length( ); i++) {
sum += inputLine.charAt(i);
}
}
is.close( );
} catch (IOException e) {
System.out.println("IOException: " + e);
} f
return sum;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment