code: public static String underscore(String camel) {
  
          StringBuilder bob = new StringBuilder(camel); // standard adds 16 extra slots for underscores
          
          // lowercase the first letter
          if (camel.charAt(0) >= 'A' && camel.charAt(0) <= 'Z')
              bob.setCharAt(0, Character.toLowerCase(camel.charAt(0)));
          
          int extra = 0;
          // i = 1, because we already lowered it
          for (int i = 1; i < camel.length(); i++) {
              char b = camel.charAt(i);
              if (b >= 'A' && b <= 'Z') { // within range
                  // lower it
                  bob.setCharAt(i + extra, Character.toLowerCase(b));
                  // add underscore
                  bob.insert(i + extra++, '_');
              }
          }
  
          return bob.toString();
      }
docs: Converts a CamelCase string to underscores: "AliceInWonderLand" becomes:
  "alice_in_wonderland"
  
  @param camel camel case input
  @return result converted to underscores.