Posts

Showing posts from June 24, 2010

What are Literals in java example

In java, literals are used for storing the constant value. Example :- “Literals” denoted String Literals, ‘P’ denoted Character Literals,  93.8 denotes floating points value Literals, 786 denotes an Integer Literals

What is primitive data type in java

Java had eight (8) primitive data type. 1) byte                  Width : 8 Range : -128 to 127 2) short                 Width : 16 Range : -32768 to 32767 3)int                       Width : 32 Range : -2147483648 to 2147483647 4) long                   Width : 64 Range : -9223372036854775808 to 9223372036854775807 Above four primitive data type belongs to Integers. 5) float                  Width : 32 Range 1.4e-045 to 3.4e+308 6) double             Width : 64 Range 4.9e-...

How to read system directory and files in java code examples

import java.io.File; public class TestDirReader{   public static void main(String[] args) {               File folder = new File("C://testDir");             File[] filesList= folder.listFiles();             for (int i = 0; i < filesList.length; i++) {               if (filesList[i].isDirectory()) {                 System.out.println("Directory Name :" + filesList[i].getName());               }else if (filesList[i].isFile()) {                 System.out.println("File Name :" + filesList[i].getName());               }    ...

How to convert image DPI in java code with image magick

public int convertDPI(String inputImage, String outputImage, String density) {         int returnCode = 0;         Process process;         try {             String[] command = { "convert", "-density", density, inputImage, outputImage };             process = Runtime.getRuntime().exec(command);             returnCode = process.waitFor();         } catch (IOException e) {             e.printStackTrace();         } catch (InterruptedException e) {             e.printStackTrace();         }         return returnCode;     }

How to make thumbnails in jpg format of Videos in Java code examples

Make  thumbnails in jpg format of  Videos : - Point to Note:- There is need to install ffmpeg in your system. public int compressVideioToJpg(String inputVideo, String outputJpg) {     int returnCode = 0;     Process process;     try {         System.out.println("compressVideioToJpg called");         System.out.println("inputVideo:"+inputVideo);         System.out.println("outputVidio:"+outputJpg);         String[] command = { "ffmpeg", "-i", inputVideo , "-an", "-r", ".1", "-y","-s","236x148", outputJpg};         System.out.println("22:");         process = Runtime.getRuntime().exec(command);         System.out.println("after process JPG");         returnCode = proce...

How to get number of days in month java code, Examples?

public static int getNoOfDays(int month, int year){     Calendar calendar = Calendar.getInstance();     int date = 1;     calendar.set(year, month, date);     int days = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);     return days; }

How to Encrypt Decrypt String in java code example

import java.io.PrintStream; public class EDU_EncryptDecrypt {     public EDU_EncryptDecrypt()     {     }     public String EDU_getEncryptionDecryptionKey(String seed, String ktype)     {         if(ktype.equals("MSTR_KEY"))             return "89245317";         else             return seed;     }     public String EDU_dataEncryptDecrypt(String istr, String kval)     {         byte bute[] = istr.getBytes();         byte bute1[] = kval.getBytes();         int count = 0;         String cstr = "";         for(int i = 0; i < bute.length; i++)         {        ...

File Chooser Java applet code example

import java.awt.Container; import java.awt.FlowLayout; import java.awt.event.*; import java.io.File; import javax.swing.*; public class Test extends JFrame {     public Test()     {         super("Simple File Chooser Application");         chooser = new JFileChooser();         button = new JButton("show file chooser ...");         Container contentPane = getContentPane();         contentPane.setLayout(new FlowLayout());         contentPane.add(button);         button.addActionListener(new ActionListener() {             public void actionPerformed(ActionEvent e)             {                 chooser.setFileSelectionMode(1);        ...

Recent Post

Recent Posts Widget