static public VersionString getNewVersion ( VersionString version , int depth ) { if ( depth < 1 || depth > version . value . length + 1 ) throw new NumberFormatException ( "The depth cannot be less than zero or greater than the depth of the current version number: " + depth ) ; int [ ] newVersion = Arrays . copyOf ( version . value , depth ) ; // only copy to the depth newVersion [ depth - 1 ] ++ ; // increment the specified version number return new VersionString ( newVersion ) ; }
This method returns a new version number in the series by incrementing the version at the specified depth and truncating the rest of the version numbers . If the current version is 2 . 5 . 7 and the depth is 2 the next version would be 2 . 6 . If the current version is 1 . 22 and the depth is 3 the next version would be 1 . 22 . 1 .