我需要使用Calender或java中的任何类来查找上个月的名称
如果它的1月份那么它必须在12月份作为上个月(如果可能,则为年份).
我正在使用p:password标签进行注册.我想在选中复选框时将字段切换为文本,当取消选中时,它将更改为密码类型模式.如何解决primefaces组件的问题.我正在使用primefaces 3.0和jsf 2.0.
如何将月份字符串转换为整数?
在点击方法中,我想显示所选的日期,但如果日期有事件,则应显示有关该事件的更多信息.检查假日事件的方法需要整数值.
这是代码:
更新:
@Override
public void onClick(View view)
{
int m = 0;
int d, y;
String date_month_year = (String) view.getTag();
selectedDayMonthYearButton.setText("Selected: " + date_month_year);
String [] dateAr = date_month_year.split("-");
Log.d(tag, "Date Split: " + dateAr[0] + " " + dateAr[1] + " " + dateAr[2]);
y = Integer.parseInt(dateAr[2]);
try {
Calendar c1 = Calendar.getInstance();
c1.setTime(new SimpleDateFormat("MMM").parse(dateAr[1]));
m = c1.get((Calendar.MONTH) + 1);
}
catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//int m = Integer.parseInt(dateAr[1]);
d …Run Code Online (Sandbox Code Playgroud) 我将DirectoryPath作为"data/data/in.com.jotSmart/app_custom/folderName/FileName"存储为String ArrayList
喜欢
ArrayList<String> a;
a.add("data/data/in.com.jotSmart/app_custom/page01/Note01.png");
Run Code Online (Sandbox Code Playgroud)
现在从这条路径我想得到page01作为单独的字符串和Note01作为单独的字符串并将其存储到两个字符串变量中.我尝试了很多,但无法得到结果.如果有人知道帮助我解决这个问题.
我的java程序中有一些值.我只是存储了这些值HashSet.我通过for循环存储它.在形成集合之后,循环迭代的值已被不同地排序.如何HashSet从循环中限制此顺序更改.有人可以帮我吗?
我在 C# 中有一个应用程序,它使用 RijndaelManaged加密我的部分文件(因为它们是大文件)。所以我将我的文件转换为字节数组并只加密其中的一部分。
然后我想使用Java解密文件。所以我只需要解密用 C# 加密的文件的一部分(意味着那些字节)。
问题来了。因为在 C# 中我们有无符号字节,而在 Java 中我们有有符号字节。所以我的加密和解密没有按照我想要的方式工作。
在 C# 中,我将加密字节和普通字节连接在一起,并使用File.WriteAllBytes. 所以我不能在这里使用sbyte或者我不知道该怎么做:
byte[] myEncryptedFile = new byte[myFile.Length];
for (long i = 0; i < encryptedBlockBytes.Length; i++)
{
myEncryptedFile[i] = encryptedBlockBytes[i];
}
for (long i = encryptedBlockBytes.Length; i < myFile.Length; i++)
{
myEncryptedFile[i] = myFileBytes[i];
}
File.WriteAllBytes(@"C:\enc_file.big", myEncryptedFile);
Run Code Online (Sandbox Code Playgroud)
(并且在 Java 中有一个完全相同的解密代码)
所以我的问题是:
首先,我将描述我想要的内容,然后我会详细说明我正在考虑的可能性.我不知道哪个最好,所以我想要一些帮助.
我有一个哈希映射,我从中读取和写入操作Servlet.现在,因为这Servlet是在Tomcat上,我需要哈希映射是线程安全的.基本上,当它被写入时,没有别的东西应该写入它,也没有任何东西也应该能够读取它.
我已经看到ConcurrentHashMap但是注意到它的get方法不是线程安全的.然后,我看到了锁和一些叫做synchronized的东西.
我想知道哪种方法最可靠.
我在Thread中遇到问题.这是我的代码
private void CustomBrightActionPerformed(java.awt.event.ActionEvent evt) {
creed = new Thread() {
public void run() {
final JFrame jfmae = new JFrame("Set BrightNess");
JLabel jla = new JLabel("!@#$");
jfmae.add(jla, BorderLayout.CENTER);
jfmae.setSize(180, 180);
jfmae.addMouseListener(new Mymos());
jfmae.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowEvent) {
jfmae.dispose();
}
});
jfmae.setVisible(true);
}
};
creed.start();
}
class Mymos extends MouseAdapter {
public void mousePressed(java.awt.event.MouseEvent evt) {
try {
creed.sleep(3000);
} catch (InterruptedException e) {
}
Bigh2MousePressed(evt);
}
private void Bigh2MousePressed(java.awt.event.MouseEvent evt) {
System.out.println("dsds");
}
}
Run Code Online (Sandbox Code Playgroud)
CustomBrightActionPerformed
是一个处理动作事件并且 …
class return{
public static void main(String args[]){
boolean t = true;
System.out.println(" this is before");
if (t) return;
System.out.println(" this is not going to be printed on the screen");
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的代码和我的命令行带来的
标识符预期错误
谁能解释问题所在?
java ×8
date ×2
datetime ×2
android ×1
c# ×1
calendar ×1
collections ×1
cryptography ×1
file ×1
html ×1
iphone ×1
itunes ×1
javascript ×1
jsf ×1
jsf-2 ×1
keyword ×1
locks ×1
primefaces ×1
set ×1
signed ×1
swing ×1
thread-sleep ×1
unsigned ×1