我被给了这个源代码并被要求编译它:它失败了,发现错误“找不到类型: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