Skip to content

Instantly share code, notes, and snippets.

/Version.java Secret

Created Jul 9, 2015
Embed
What would you like to do?
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