Created
September 12, 2014 18:58
-
-
Save benjholla/ebc83bc5670272b568c1 to your computer and use it in GitHub Desktop.
Dataflow laundering
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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