'2010/09'에 해당되는 글 3건

  1. 2010/09/28 Java's Primitive Data Types (1)
  2. 2010/09/27 Java Calendar 에서 month 는 zero-based
  3. 2010/09/15 안드로이드용 테트리스 2 (3)

Java's Primitive Data Types

boolean

1-bit. May take on the values true and false only.

true and false are defined constants of the language and are not the same as True and False, TRUE and FALSE, zero and nonzero, 1 and 0 or any other numeric value. Booleans may not be cast into any other type of variable nor may any other variable be cast into a boolean.

byte

1 signed byte (two's complement). Covers values from -128 to 127.

short

2 bytes, signed (two's complement), -32,768 to 32,767

int

4 bytes, signed (two's complement). -2,147,483,648 to 2,147,483,647. Like all numeric types ints may be cast into other numeric types (byte, short, long, float, double). When lossy casts are done (e.g. int to byte) the conversion is done modulo the length of the smaller type.

long

8 bytes signed (two's complement). Ranges from -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807.

float

4 bytes, IEEE 754. Covers a range from 1.40129846432481707e-45 to 3.40282346638528860e+38 (positive or negative).

Like all numeric types floats may be cast into other numeric types (byte, short, long, int, double). When lossy casts to integer types are done (e.g. float to short) the fractional part is truncated and the conversion is done modulo the length of the smaller type.

double
8 bytes IEEE 754. Covers a range from 4.94065645841246544e-324d to 1.79769313486231570e+308d (positive or negative).
char

2 bytes, unsigned, Unicode, 0 to 65,535

Chars are not the same as bytes, ints, shorts or Strings.



출처 :
http://www.cafeaulait.org/course/week2/02.html

Trackback Address :: http://seirion.com/trackback/202 관련글 쓰기

댓글을 달아 주세요

  1. 바보세룐 2010/09/28 11:58 Address Modify/Delete Reply

    long 이 8 byte 였다니 ㅠㅠ
    게다가 unsigned integer 타입은 존재하지 않고,
    char 만이 unsigned 로 사용된다 -_-;;

    요건 참고.
    http://mindprod.com/jgloss/unsigned.html

안드로이드로 날짜를 산수해 보다가 ...
2010년 8월 31일을 넣었는데, 이상하게 계속 2010 년 9월 1일이 찍히는 희한한 일이 있었다.



이렇게 하면 year, month, day 는 각각 2010, 9, 1 이 할당된다.
한참 삽질한 결과 month 만 zero-based 로 동작한다는 사실을 알게되었다.

고로 내가 set 함수를 통해 2010년 8월 31일을 입력하려고 했지만,
사실은 2010년 9월 31일을 입력한 것이다.
따라서 31 일은 날짜 범위를 벗어났기 때문에
month 는 9가 되고 day 는 1로 reset 된 것 같다.

2010년 8월 31일을 설정하려면 다음과 같이 해야 한다.
set(2010, 8 - 1, 31);

음 ... -_-;; 클래스를 이렇게 만든 이유가 궁금하다.
사람 개고생 시키기인가 ㅠㅠㅠㅠㅠㅠㅠ

Trackback Address :: http://seirion.com/trackback/200 관련글 쓰기

댓글을 달아 주세요

사용자 삽입 이미지
























지난 번에 만들었던 안드로이드 테트리스는 그야 말로 첨으로 만들어 본 수준이었고,
게다가 에뮬레이터와 QWERTY 가 있는 옵티머스Q 에서만 테스트 되었기 때문에
키패드가 없으면 게임을 할 수 없는(-_-) 치명적인 단점이 존재했습니다 ㅠㅠㅠㅠㅠㅠㅠㅠ

어쨌든 이왕 하는 김에 제대로 완성되고 돌아가는 걸 한 번 만들어 보자는 생각에,
새롭게 게임을 만들었습니다.

코드는 구글 코드에 있고, Apache License, Version 2.0 을 채용 했습니다.
모든 코드는 제가 다 직접 코딩 했습니다. (다른 사이트 참고 하면서 많이 배우면서 하긴 했습니다만 ^^;;)
때문에 저의 코드를 이용하는 데는 제한이 없습니다. (그런 사람도 없겠지만 ...)
물론 상업적으로도 이용가능합니다(만 테트리스라는 게임에 라이센스가 있어 그럴 순 없겠죠 ? ^^;;;)
(테트리스 저작권 관련 글 : http://114copyright.tistory.com/24 )
숙제 할 때 코드를 쓰든, 상업 코드에 이용하든 관계 없습니다. 알아서들 하시고 ...


구글 코드 : http://code.google.com/p/babotetris/
svn 으로 다운 받을 수 있습니다.
 svn checkout http://babotetris.googlecode.com/svn/trunk/ .

조작 하는 방법은 대략 2 가지 모드가 있는데,
터치 모드는 좌/우/상/하 로 화면을 쓸면 됩니다.(Fling)
버튼 모드는 화면을 3등분 해서 왼쪽을 터치하면 좌, 오른쪽을 터치하면 우,
가운데를 터치하면 블럭이 회전 합니다.
(게임 화면에서 메뉴 버튼을 눌러 보세요 ~ )

아직 버그도 있고, 덜 완성 되었습니다만, 그래도 일단 게임이 되긴 하므로 공개합니다 ^^;
당분간은 update 될 것 같군요.
(개발과 테스트는 주로 옵티머스Z 에서 합니다)

그냥 연습용으로 만들어 본 거라 마켓에 올릴 생각은 없습니다.
(라이센스 문제도 있고 ^^; 사진도 임의로 올린 거라 ... ^^;;;;)



- 기록 페이지는 미완성

- 영어가 konglish 임 ㅠㅠㅠㅠㅠㅠ

- 코드에 영혼을 담으려 하였으나, 일부 미숙할 수 있음


Trackback Address :: http://seirion.com/trackback/198 관련글 쓰기

댓글을 달아 주세요

  1. |꼬마늑대| 2010/09/17 16:29 Address Modify/Delete Reply

    - 미완성인 상태로 끝까지 갈지도..
    - 나도 그래서 주석은 한글로 씀. ㅠㅠㅠㅠㅠㅠ
    - 원래 큰 일을 하는 사람은 작은 일에는 미숙하기 마련.. 큰 일을 하도록. ㅋㅋ