Ray da Costa

Arquivo da categoria ‘Java Util’

Plugin NetBeans para Android

Terça, 17 de Novembro de 2009

Está no forno mas parece que vai ser 10!!!
Link

Pegar IP da maquina local com Java

Quinta, 13 de Agosto de 2009

1. System.out.println(InetAddress.getLocalHost().getHostName());
2. System.out.println(InetAddress.getLocalHost().getHostAddress());

Formatar numeros e datas

Quinta, 13 de Agosto de 2009

Formatar numeros e datas
NUMEROS
NumberFormat formatter = new DecimalFormat(”000000″);
String s = formatter.format(-1234.567);
R: -001235
formatter = new DecimalFormat(”##”);
s = formatter.format(-1234.567);
R: -1235
formatter = new DecimalFormat(”.00″);
s = formatter.format(-.567);
R: -.57
DATAS
Format formatter;
formatter = new SimpleDateFormat(”yy”);
R: 02
formatter = new SimpleDateFormat(”yyyy”);
R: 2002
formatter = new SimpleDateFormat(”dd/MM/yy”);
String s = formatter.format(date);
R: 01/09/09
formatter = new SimpleDateFormat(”dd/MM/yyyy”);
String s = formatter.format(date);
R: 01/09/2009
Fonte