我被給了這個源代碼並被要求編譯它:它失敗了,發現錯誤「找不到類型:int required:java.lang.Short」。找到了不可兌換的類型:int required:java.lang.Short
該代碼做一個按位移轉換一些散列(我認爲)值爲整數。遇到此語句時,編譯器失敗「>>> = 5;」
... try {...
// Query data
SelectQuery = "select "
+ "... "
+ "from "
+ "subscrib a, "
+ "account b "
+"where "
+"a.cardid>0 "
+ "and "
+ "b.camc_card_id>0 "
+ "and "
+ "a.cardid=b.camc_card_id "
+"and "
+ "a.cardid >= ? and a.cardid <= ?";
CApStmt = CAconn.prepareStatement(SelectQuery);
// We set the card id ranges
CApStmt.setLong(1, mincardversion[0]);
CApStmt.setLong(2, maxcardversion[0]);
CArs = CApStmt.executeQuery();
while (CArs.next()) {
// We retrieve all columns from source table
long SUBID = CArs.getLong(1);
Date NEWCARDDATE = CArs.getDate(2);
int CSSNUMBER = CArs.getInt(3);
String ZIPCODE = CArs.getString(4);
int SUBREGIONS = CArs.getBinaryStream(5).read();
int CALLBACKDAY = CArs.getBinaryStream(6).read();
/*
* This field contains two-byte bitmap with the following
* format: Bits 15-11 : Hour <- Bits 10-5 : Minutes <- Bits
* 4-0 : Seconds/2
*/
Short s = CArs.getShort(7);
/* Bits 0-4 : Seconds (bitwise AND operation) */
int secs = s & 0x1F;
int seconds = secs/2;
/* Bits 5-10 : Minutes (bitwise AND operation) */
s >>>= 5;
int min = s & 0x1F;
int minutes = min * 60;
..........
該代碼的原始作者發誓上下,它用於編譯,但不能幫助我。我只知道編譯一個類或構建一個包。
請注意,由於其大小,我從此代碼片段中刪除了SQL查詢...任何想法可能是什麼問題?
謝謝。 「短」而不是「短」是它所需要的。 – Chris 2010-12-17 23:18:56