본문 바로가기

반응형

2014/01/09

(5)
[JAVA] QRCode 출력 및 바코드 출력 자바를 이용한 이미지로 바코드 출력 소스로, 사용자가 원하는 이미지 TYPE과 SIZE를 정의 출력하여, PDF출력이나 엑셀출력시 클래스를 불러와 라벨작업에 활용가능하다. import java.io.File;import java.io.FileOutputStream; import com.google.zxing.BarcodeFormat;import com.google.zxing.client.j2se.MatrixToImageWriter;import com.google.zxing.common.BitMatrix;//import com.google.zxing.oned.Code39Writer;import com.google.zxing.qrcode.QRCodeWriter; public class Qrcode {publ..
[JAVA] Ex004 어제, 내일 날짜 구하기 소스 import java.util.*;public class CalendarAfAndBfMain{public static void main(String[] args) {CalendarAfAndBf cal=new CalendarAfAndBf();//setDate의 주석을 풀자Date d=cal.setDate(2013, 8,31);System.out.println("기준날 :"+d.toString());System.out.println("다음날 :"+cal.afterOneDay(d));System.out.println("기준날 :"+cal.beforOneDay(d));}} class CalendarAfAndBf {/** * 입력한 다음날을 구한다. * @param d 입력 다음 날을 출력하기 위한 입력 날 * ..
[JAVA] Ex003 솟수 판단 소스 public class HelloCommentMain {public static void main(String[] args) {HelloComment hc = new HelloComment();System.out.printf("2343251은 솟수일까? %b%n", hc.isPri(2343251));}}class HelloComment {public boolean isPri(int a) {boolean isP = true;int b = (int) Math.sqrt(a);for (int i = 2; i
[JAVA] Ex002 윤년출력 및 판단 소스 public class IfLeapYear {public static void main(String[] args) {for (int year = 1998; year < 2020; year++) {boolean yearTF = false;if ((0 == (year % 4) && 0 != (year % 100)) || 0 == year % 400) {yearTF = true;} else {yearTF = false;} if (yearTF) {// System.out.println(year+"는 윤년입니다. ");System.out.printf("%d는 윤년입니다.%n", year);} else {// System.out.println(year+"는 윤년이 아닙니다.");System.out.printf("%..
[JAVA] Ex001 윤년판단 소스 public class HelloCalendar {//윤년인가? non staticpublic boolean isLeapYear(int year){boolean yearTF=false;if( ((year % 4==0) && (year %100 !=0)) || year%400==0 ){yearTF = true;}return yearTF;}//윤년인가? staticpublic static boolean isLeapSY(int year){boolean yearTF=false;if( ((year % 4==0) && (year %100 !=0)) || year%400==0 ){yearTF = true;}return yearTF;}public static void main(String[] args) {HelloCa..

반응형