public static String javaDecode(String s){
  int length=s.length();
  StringBuilder buff=new StringBuilder(length);
  for (int i=0; i < length; i++) {
    char c=s.charAt(i);
    if (c == '\\') {
      if (i + 1 >= s.length()) {
        throw getFormatException(s,i);
      }
      c=s.charAt(++i);
switch (c) {
case 't':
        buff.append('\t');
      break;
case 'r':
    buff.append('\r');
  break;
case 'n':
buff.append('\n');
break;
case 'b':
buff.append('\b');
break;
case 'f':
buff.append('\f');
break;
case '#':
buff.append('#');
break;
case '=':
buff.append('=');
break;
case ':':
buff.append(':');
break;
case '"':
buff.append('"');
break;
case '\\':
buff.append('\\');
break;
case 'u':
{
try {
c=(char)(Integer.parseInt(s.substring(i + 1,i + 5),16));
}
 catch (NumberFormatException e) {
throw getFormatException(s,i);
}
i+=4;
buff.append(c);
break;
}
default :
if (c >= '0' && c <= '9') {
try {
c=(char)(Integer.parseInt(s.substring(i,i + 3),8));
}
 catch (NumberFormatException e) {
throw getFormatException(s,i);
}
i+=2;
buff.append(c);
}
 else {
throw getFormatException(s,i);
}
}
}
 else {
buff.append(c);
}
}
return buff.toString();
}

public static String javaDecode ( String s ) { int length = s . length ( ) ; StringBuilder buff = new StringBuilder ( length ) ; for ( int i = 0 ; i < length ; i ++ ) { char c = s . charAt ( i ) ; if ( c == '\\' ) { if ( i + 1 >= s . length ( ) ) { throw getFormatException ( s , i ) ; } c = s . charAt ( ++ i ) ; switch ( c ) { case 't' : buff . append ( '\t' ) ; break ; case 'r' : buff . append ( '\r' ) ; break ; case 'n' : buff . append ( '\n' ) ; break ; case 'b' : buff . append ( '\b' ) ; break ; case 'f' : buff . append ( '\f' ) ; break ; case '#' : buff . append ( '#' ) ; break ; case '=' : buff . append ( '=' ) ; break ; case ':' : buff . append ( ':' ) ; break ; case '"' : buff . append ( '"' ) ; break ; case '\\' : buff . append ( '\\' ) ; break ; case 'u' : { try { c = ( char ) ( Integer . parseInt ( s . substring ( i + 1 , i + 5 ) , 16 ) ) ; } catch ( NumberFormatException e ) { throw getFormatException ( s , i ) ; } i += 4 ; buff . append ( c ) ; break ; } default : if ( c >= '0' && c <= '9' ) { try { c = ( char ) ( Integer . parseInt ( s . substring ( i , i + 3 ) , 8 ) ) ; } catch ( NumberFormatException e ) { throw getFormatException ( s , i ) ; } i += 2 ; buff . append ( c ) ; } else { throw getFormatException ( s , i ) ; } } } else { buff . append ( c ) ; } } return buff . toString ( ) ; }
decode a text that is encoded as a java string literal . the java properties file format and java source code format is supported .
