Skip to content

Instantly share code, notes, and snippets.

@benjholla
Created September 12, 2014 18:58
Show Gist options
  • Save benjholla/ebc83bc5670272b568c1 to your computer and use it in GitHub Desktop.
Save benjholla/ebc83bc5670272b568c1 to your computer and use it in GitHub Desktop.
Dataflow laundering
/**
* A toy example of laundering data through "implicit dataflow paths"
* The launder method uses the input data to reconstruct a new result
* with the same value as the original input.
*
* @author Ben Holland
*/
public class DataflowLaunder {
public static void main(String[] args) {
String x = "1010";
String y = launder(x);
System.out.println(y + " is a laundered version of " + x);
}
public static String launder(String data){
String result = "";
for(char c : data.toCharArray()){
if(c == '0')
result += '0';
else
result += '1';
}
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment