Skip to content

Instantly share code, notes, and snippets.

/Version.java Secret

Created July 9, 2015 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/0b81793e1972c3cccd81 to your computer and use it in GitHub Desktop.
Save anonymous/0b81793e1972c3cccd81 to your computer and use it in GitHub Desktop.
public class Version {
private int major;
private int minor;
private int bugfix;
public Version(String version) {
int dot1 = version.indexOf('.');
int dot2 = version.lastIndexOf('.');
major = Integer.parseInt(version.substring(0, dot1));
minor = Integer.parseInt(version.substring(dot1 + 1, dot2));
bugfix = Integer.parseInt(version.substring(dot2 + 1));
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment