int i = 639;
String str = String.valueOf ( i );
String str = Integer.toString ( i );
String str = i.toString ( );
2. 문자열을 숫자로 바꾸기
String str = "639";
int i = Integer.valueOf ( str ).intValue ( );
int i = Integer.parseInt ( str );
long i = Long.parseLong ( str )
double j = Double.valueOf ( str ).doubleValue ( );
3. 기타 형변환
Float를 Integer로 바꾸기
float f = 3.25;
int i = ( int ) f;
double d = ( double ) i; // float 형
Object를 int 타입으로 형변환 하기 ... 바로 안되므로 String으로 바꾼후 int로 형변환 한다.
Integer.parseInt ( vector.elementAt ( 0 ).toString () );
VIP석 120,000원 / R석 100,000원 / S석 60,000원 / A석 40,000원
</body>
//입주기관, 및 검색조건에 따른 검색결과
public Vector search() throws Exception {
StringBuffer sbQuery = new StringBuffer();
//쿼리생성
String query = super.xml.getQuery(QUERY_URL, "syslog_02", "02");
sbQuery.append(query);
//파라미터들 가져오기
String Start_Date = requestbox.get("Start_Date"); //시작일
String End_Date = requestbox.get("End_Date"); //마지막일
String biz_time= requestbox.get("biz_time");//업무시간
String start_time = requestbox.get("start_time"); //업무시간
String end_time= requestbox.get("end_time");//업무시간
String select_custcomp= requestbox.get("select_custcomp");//입주기관
String ip_hostname= requestbox.get("ip_hostname");//장비명
String message= requestbox.get("message");//검색 메시지
String select_Facility= requestbox.get("select_Facility");//Facility명
String select_priority= requestbox.get("select_priority");//Priority
//기본으로 날짜검색 파라미터
logger.debug("시작시간: [" + Start_Date + "]");
logger.debug("종료시간: [" + End_Date + "]");
logger.debug("비즈타임: [" + biz_time + "]");
logger.debug("select_Facility: [" + select_Facility + "]");
logger.debug("select_priority: [" + select_priority + "]");
Vector vecResultData = new Vector();
String query_st1 = new String(sbQuery);
sbQuery = new StringBuffer(query_st1);
// 메시지검색
String LOG_MESSAGE = " and A.LOG_MESSAGE like '%" + message + "%'";
// 입주기관
String CUSTCOMP = "";
if (select_custcomp.equals("")||select_custcomp.equals("all")){
CUSTCOMP = "";
} else {
CUSTCOMP = " and d.custcomp_name = '" + select_custcomp +"'";
}
// Facility
String Facility_param = "";
if (select_Facility.equals("")||select_Facility.equals("all")){
Facility_param = "";
} else {
Facility_param = " and c.code_name = '" + select_Facility +"'";
}
// Priority
String Priority_param = "";
if (select_priority.equals("")||select_priority.equals("all")){
Priority_param = "";
} else {
Priority_param = " and b.code_name = '" + select_priority +"'";
}
// 장비명
String HOSTNAME = "";
if (ip_hostname.equals("")||ip_hostname.equals("all")){
HOSTNAME = "";
} else {
HOSTNAME = " and t.ip_hostname = '" + ip_hostname +"'";
}
String STARTDATE = " and to_date(a.yyyymmdd,'YYYYMMDD') >= to_date(substr('" + Start_Date + "',0,8), 'YYYYMMDD')";
String ENDDATE = " and to_date(a.yyyymmdd,'YYYYMMDD') <= to_date(substr('" + End_Date + "',0,8), 'YYYYMMDD')";
String STARTTIME = "";
String ENDTIME = "";
if (biz_time.equals("biz_time")){
STARTTIME = " and substr(a.hhminss,0,2) >= " + start_time ;
ENDTIME = " and substr(a.hhminss,0,2) <= " + end_time;
} else {
STARTTIME = "";
ENDTIME = "";
}
String query_st2 = new String(sbQuery);
sbQuery = new StringBuffer(query_st2);
sbQuery.append(STARTDATE).append("\n");
sbQuery.append(ENDDATE).append("\n");
sbQuery.append(STARTTIME).append("\n");
sbQuery.append(ENDTIME).append("\n");
sbQuery.append(LOG_MESSAGE).append("\n");
sbQuery.append(CUSTCOMP).append("\n");
sbQuery.append(HOSTNAME).append("\n");
sbQuery.append(Priority_param).append("\n");
sbQuery.append(Facility_param).append("\n");
logger.debug("검색쿼리 --> " + sbQuery);
String param[] = null;
vecResultData = queryIf.preparedExecuteQuery(UNMSDB2, sbQuery.toString(), param);
logger.debug("====" + vecResultData.size() + "결과사이즈");
return vecResultData;
[출처] qnp vector java bean servlet |작성자 제로스엘