public double [ ] getCoordinates ( String inputString ) throws TypeConversionException { String [ ] cstr = inputString . split ( "," ) ; int coordLength ; if ( cstr . length % 2 == 0 ) { coordLength = cstr . length ; } else { coordLength = cstr . length - 1 ; } double [ ] coordinates = new double [ coordLength ] ; try { for ( int index = 0 ; index < coordLength ; index ++ ) { coordinates [ index ] = Double . parseDouble ( cstr [ index ] ) ; } return coordinates ; } catch ( NumberFormatException e ) { throw new TypeConversionException ( "String contains non-numeric data. Impossible to create envelope" , e ) ; } }
Retrieves a list of coordinates from the given string . If the number of numbers in the string is odd the last number is ignored .