●文字列を整数に変換

Integer.parseInt(str)


-----------------------------------------------
class Sample{

public static void main(String[] args) {
// TODO code application logic here
String str = "4";
int num = Integer.parseInt(str);
System.out.println(num);
}

}
-----------------------------------------------
●URL
openStream()

---------------------------------------------------------------
import java.io.*;
import java.net.*;

class URLDemo{
public static void main(String args[]){
try{
//
URL url = new URL(args[0]);
//
InputStream is = url.openStream();
//
byte buffer[] = new byte[1024];
int i;
while((i = is.read(buffer)) != -1){
System.out.write(buffer, 0, i);
}
}
catch(Exception e){
e.printStackTrace();
}
}
}
---------------------------------------------------------------

使用例 JAVA URLDemo http://yahoo.co.jp/
●ローカルアドレスの取得2
getLocalHost()

---------------------------------------------------------------
import java.net.*;

public class IPAddress2 {

public static void main(String args[]) {
//
InetAddress host = null;
try {
host = InetAddress.getLocalHost();
}
catch(UnknownHostException e) {
System.err.println(e);
return;
}
System.out.println(host);

}

}
---------------------------------------------------------------