Changeset 12130 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2017-05-13T00:56:58+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Utils.java
r12015 r12130 1586 1586 return angleDeg * TO_RADIANS; 1587 1587 } 1588 1589 /** 1590 * Returns the Java version as an int value. 1591 * @return the Java version as an int value (8, 9, etc.) 1592 * @since 12130 1593 */ 1594 public static int getJavaVersion() { 1595 String version = System.getProperty("java.version"); 1596 if (version.startsWith("1.")) { 1597 version = version.substring(2); 1598 } 1599 // Allow these formats: 1600 // 1.8.0_72-ea 1601 // 9-ea 1602 // 9 1603 // 9.0.1 1604 int dotPos = version.indexOf('.'); 1605 int dashPos = version.indexOf('-'); 1606 return Integer.parseInt(version.substring(0, 1607 dotPos > -1 ? dotPos : dashPos > -1 ? dashPos : 1)); 1608 } 1588 1609 }
Note:
See TracChangeset
for help on using the changeset viewer.