BLOG main image
분류 전체보기 (42)
잡담 (6)
활용 (17)
language (3)
project (14)
design (2)
자료정리 (0)
결혼 준비 (0)
sarl pyver
sarl pyver
geometry dash apk zippy
geometry dash apk zippy
geometry dash apk full
geometry dash apk full
cheap christian louboutin
cheap christian louboutin
herehoju.com
herehoju.com
233,487 Visitors up to today!
Today 65 hit, Yesterday 23 hit
daisy rss
tistory 티스토리 가입하기!
2013.01.26 01:06

자바에서 문자열을 right shift 하는 방법이 딱히 없어서 간단하게 작성했다.


	public final static String shiftr(String str, int size) {
		byte[] orgByte = null;
		byte[] resultByte = new byte[str.length()];
		try {
			orgByte = str.getBytes("ASCII");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}

		int strlen = orgByte.length;
		for(int i=0; i < strlen; i++) {
			resultByte[(i+size) % strlen] = orgByte[i];
		}
		String result = null;
		try {
			result = new String(resultByte, "ASCII");
		} catch (UnsupportedEncodingException e) {
		}
		System.out.println(result);
		return result;
	}
Name
Password
Homepage
Secret

티스토리 툴바