Incompatible types required boolean found string

I am trying to set a value for a variable called Location when ever the value for the location is "AFRICA"
I need to reset it to be "55555".
What I am getting is that 'Incompatible types required boolean found string' under the if statemant. Can anyone shade some light on this?
String Location = filename.substring(12,17);
String AP = "AFRICA";
System.out.println(Location);
if (Location = AP)
System.out.println(Location);
Location = "55555";
thanks

rp0428 wrote:
The IF condition needs to be a BOOLEAN. The '=' is used to do an assignment. The boolean would be '=='.
But to compare strings why aren't you using
if (Location.equalsIgnoreCase(AP) {
To stress this a little more:
<tt>==</tt> applied between References will compare the Adresses they point to. This means this will only be true if both References point to the identical Object. @Test
testStringEquality(){
   String s1 = "my Test"
   String s2 = "Test"
  Assert.assertTrue("This strings are equal",s1.equals("my "+s2));
  Assert.assertFalse("This strings are not identical",s1 == ("my "+s2));
}So use <tt>==</tt> only for primitive number types (those starting with a lower case letter).
bye
TPD

Similar Messages

  • Unexpected type  required: variable   found   : value

    Hello, these are my errors:
    PWC6197: An error occurred at line: 43 in the jsp file: /jsp/ListRedirect.jsp
    PWC6199: Generated servlet error:
    string:///ListRedirect_jsp.java:96: unexpected type
    required: variable
    found : value
    PWC6197: An error occurred at line: 43 in the jsp file: /jsp/ListRedirect.jsp
    PWC6199: Generated servlet error:
    string:///ListRedirect_jsp.java:96: incomparable types: java.lang.String and int
    ==================================
    any suggestions??
    <%      
    if (listData.getListURL()= null || listData.getListInfo() == 0)
              String baseUrl = "/content/listings.html?";
             String listUrl = null;
                  if (userData.isAgentType()) {
                    listUrl = parentPage + baseUrl + "ag_id=" + userData.getAgentID();
                  }  if (userData.isBrokerType()) {
                  listUrl = parentPage + baseUrl + "br_id=" + userData.getAdverID();
                  }  if (userData.isOfficeType()) {
                  listUrl = parentPage + baseUrl + "ag_id="= + userData.getAdverID();
                  } else {
                  listUrl = parentPage + "/content/homefinder.html";
                   if (listData.getListURL() && listData.getListInfo() == 1) {
                       listUrl = listData.getListURL();
               else {
                    listUrl = parentPage + "/content/homefinder.html";
    %>     

    mimsc wrote:
    if (listData.getListURL()= null || listData.getListInfo() == 0)
    The 1st part of this if statement is incorrectly an assignment, not a equation.
    Further on, this code belongs in Java classes like servlets, not in JSPs. This would not only introduce clean code separation, but also greatly improve debugging and maintenance.

  • Incompatible types - found, required...

    Experts,
    I am getting the following failure. What am I missing?
    Javac output,
    #javac .\org\ocap\dvr\*.java
    .\org\ocap\dvr\TestRecord.java:123: incompatible types
    found : org.ocap.shared.dvr.RecordingManager
    required: org.ocap.dvr.OcapRecordingManager
    recManager = OcapRecordingManager.getInstance();
    ^
    The source code is as follows,
    In .\src\org\ocap\shared\dvr\RecordingManager.java
    ----------------- START --------------------
    package org.ocap.shared.dvr;
    public abstract class RecordingManager
    public static RecordingManager getInstance()
    return null;
    // stuff deleted
    ------------------ END -------------------
    In .\src\org\ocap\dvr\OcapRecordingManager.java
    ----------------- START --------------------
    package org.ocap.dvr;
    import org.ocap.dvr.*;
    import org.ocap.shared.dvr.*;
    public abstract class OcapRecordingManager extends RecordingManager
    // stuff deleted
    ------------------ END -------------------
    In .\src\org\ocap\dvr\OcapRecordingManagerImpl.java
    ----------------- START --------------------
    package org.ocap.dvr;
    import org.ocap.dvr.*;
    import org.ocap.shared.dvr.*;
    public class OcapRecordingManagerImpl extends OcapRecordingManager
    private static OcapRecordingManager mOcapRecordingManager = null;
    public static OcapRecordingManager getInstance()
    if (mOcapRecordingManager == null)
    mOcapRecordingManager = new OcapRecordingManagerImpl();
    return mOcapRecordingManager;
    ------------------ END -------------------
    In .\src\org\ocap\dvr\TestRecord.java
    ----------------- START --------------------
    package org.ocap.dvr;
    import org.ocap.dvr.OcapRecordingManager;
    import org.ocap.shared.dvr.RecordingManager;
    class TestRecord
    //Object of OcapRecordingManager class
    private static OcapRecordingManager recManager = null;
    public static void main(String args[])
    recManager = OcapRecordingManager.getInstance();
    if(recManager == null)
    System.out.println ("Value obtained in OcapRecordingManagerImpl reference is null");
    ------------------ END -------------------
    Thanks!

    Please don't crosspost!
    http://forum.java.sun.com/thread.jspa?threadID=5210277&messageID=9846716#9846716

  • Incompatible types - found java.lang.String but expected int

    This is an extremely small simple program but i keep getting an "incompatible types - found java.lang.String but expected int" error and dont understand why. Im still pretty new to Java so it might just be something stupid im over looking...
    import java.io.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class Lab
    public static void main(String []args)
    int input = JOptionPane.showInputDialog("Input Decimal ");
    String bin = Integer.toBinaryString(input);
    String hex = Integer.toHexString(input);
    System.out.println("Decimal= " + input + '\n' + "Binary= " + bin + '\n' + "Hexadecimal " + hex);
    }

    You should always post the full, exact error message.
    Your error message probably says that the error occurred on something like line #10, the JOptionPane line. The error is telling you that the compiler found a String value, but an int value was expected.
    If you go to the API docs for JOptionPane, it will tell you what value type is returned for showInputDialog(). The value type is String. But you are trying to assign that value to an int. You can't do that.
    You will need to assign the showInputDialog() value to a String variable. Then use Integer.parseInt(the_string) to convert to an int value.

  • Error in Parser.fx file "incompatible types found   : java.util.Properties"

    Hi,
    In parser file "Parser.fx",
    public-read def PROPERTIES_PARSER = StreamParser {
    override public function parse(input : java.io.InputStream) : RecordSet {
    var props = javafx.util.Properties {};
    props.load(input);
    input.close();
    MemoryRecordSet {
    records: [
    MapRecord {
    fields: props
    due to under line portion an error is appearing:
    "incompatible types
    found : javafx.util.Properties
    required: java.util.Map
    fields: props".
    Please suggest some solution.
    Thanks in advance.
    regards,
    Choudhary Nafees Ahmed
    Edited by: ChoudharyNafees on Jul 5, 2010 3:48 AM

    Parser.fx
    package org.netbeans.javafx.datasrc;
    import javafx.data.pull.PullParser;
    import javafx.data.pull.Event;
    import org.netbeans.javafx.datasrc.MemoryRecordSet;
    public-read def PROPERTIES_PARSER = StreamParser {
        override public function parse(input : java.io.InputStream) : RecordSet {
            var props =java.util.Properties{};
            props.load(input);
            input.close();
            MemoryRecordSet {
                records: [
                    MapRecord {
                        fields: props
    public-read def LINE_PARSER_FIELD_LINE = ".line";
    public-read def LINE_PARSER = StreamParser {
        override public function parse(input : java.io.Reader) : RecordSet {
            var line : String;
            var result : Record [] = [];
            line = readLine(input);
            // BEWARE  ("" == null) is true
            while (line != null or "".equals(line)) {
                var map = new java.util.HashMap();
                map.put(LINE_PARSER_FIELD_LINE, line);
                var record = MapRecord {
                    fields: map
                insert record into result;
                line = readLine(input);
            MemoryRecordSet {
                records: result
    function readLine(in : java.io.Reader) : String {
        var str = new java.lang.StringBuilder;
        while (true) {
            var c = in.read();
            if (c == -1) {
                return if (str.length() == 0) then null else str.toString();
            } else if (c == 0x0D) {
                c = in.read();
                if (c == 0x0A or c == -1) {
                    return str.toString();
                str.append(0x0D);
            } else if (c == 0x0A) {
                return str.toString();
            str.append(c as Character);
        str.toString()
    public-read def JSON_PARSER = StreamParser {
        function toSequence(list : java.util.List) : Record [] {
            var result : Record [] = [];
            var ii = list.iterator();
            while (ii.hasNext()) {
                var r = ii.next() as Record;
                insert r into result;
            result
        override public function parse(input : java.io.InputStream) : RecordSet {
            var topLevel : Object;
            def parser = PullParser {
                documentType: PullParser.JSON
                input: input
                var mapStack = new java.util.Stack();
                var currentMap : java.util.Map;
                var recordsStack = new java.util.Stack();
                var currentRecords : java.util.List;
                var lastEvent: Event;
                onEvent: function(event: Event) {
                    if (event.type == PullParser.TEXT) {
                        currentMap.put(event.name, event.text)
                    } else if (event.type == PullParser.INTEGER) {
                        currentMap.put(event.name, event.integerValue)
                    } else if (event.type == PullParser.NULL) {
                        currentMap.put(event.name, null)
                    } else if (event.type == PullParser.START_ELEMENT) {
                        if (lastEvent.type == PullParser.START_ARRAY_ELEMENT) return;
                        var oldMap = currentMap;
                        var temp = new java.util.HashMap();
                        temp.put(new Object(), null);
                        currentMap = temp;
                        currentMap.clear();
                        mapStack.push(currentMap);
                        if (topLevel == null) topLevel = currentMap;
                        if (oldMap != null) {
                            var mr = MapRecord {
                                fields: currentMap
                            if (event.name == "" and lastEvent.type == PullParser.START_VALUE) {
                                oldMap.put(lastEvent.name, mr)
                            } else {
                                oldMap.put(event.name, mr)
                    } else if (event.type == PullParser.START_ARRAY_ELEMENT) {
                        var temp = new java.util.HashMap();
                        temp.put(new Object(), null);
                        currentMap = temp;
                        currentMap.clear();
                        mapStack.push(currentMap);
                        var mr = MapRecord {
                            fields: currentMap
                        currentRecords.add(mr);
                    } else if (event.type == PullParser.END_ELEMENT) {
                        mapStack.pop();
                        if (not mapStack.empty()) {
                            currentMap = mapStack.peek() as java.util.HashMap;
                        } else {
                            currentMap = null;
                    } else if (event.type == PullParser.END_ARRAY_ELEMENT) {
                        if (lastEvent.type == PullParser.END_ELEMENT) return;
                        mapStack.pop();
                        if (not mapStack.empty()) {
                            currentMap = mapStack.peek() as java.util.HashMap;
                        } else {
                            currentMap = null;
                    } else if (event.type == PullParser.START_ARRAY) {
                        currentRecords = new java.util.ArrayList();
                        recordsStack.push(currentRecords);
                        if (topLevel == null) topLevel = currentRecords;
                    } else if (event.type == PullParser.END_ARRAY) {
                        var set = MemoryRecordSet {
                            records: toSequence(currentRecords)
                        currentMap.put(event.name, set);
                        recordsStack.pop();
                        if (not recordsStack.empty()) {
                            currentRecords = recordsStack.peek() as java.util.List;
                        } else {
                            currentRecords = null;
                    lastEvent = event;
            parser.parse();
            if (topLevel instanceof java.util.Map) {
                var mr = MapRecord {
                    fields: topLevel as java.util.Map
                MemoryRecordSet {
                   records: [mr]
            } else {
                // List
                var rs = MemoryRecordSet {
                    records: toSequence(topLevel as java.util.List)
                rs
            parser.parse();
            var mr = MapRecord {
                fields: topLevel as java.util.Map
            MemoryRecordSet {
               records: [mr]

  • Incompatible type  -  use of String datatype?

    I tried to compile the program but it seems to show "synax errors".
    What I complied the program below:
    import java.util.Scanner;
    public class String
       public static void main(String[] args)
          // declare constants and variables
          String tutorName;
          String stdtName;
          // read input data
          Scanner scn = new Scanner(System.in);
          System.out.print("Enter tutor's name : ");
          tutorName = scn.next();
          System.out.print("Enter student's name : ");
          stdtName = scn.next();
          // display output
          System.out.println ("Tutor's Name : " + tutorName);
          System.out.println ("Tutor's Name : " + stdtName);
    }The error message says:
    ----jGRASP exec: javac -g D:\String.java
    String.java:20: incompatible types
    found : java.lang.String
    required: String
    tutorName = scn.next();
                                    ^
    String.java:22: incompatible types
    found: java.lang.String
    required: String
    stdtName = scn.next();
                                  ^
    2 errors
    ----jGRASP wedge2: exit code for process is 1.
    ----jGRASP: operation complete.Edited by: soulhealer88 on May 28, 2008 8:11 AM

    BIJ001 wrote:
    java.lang.String tutorName;
    That would quickly become painful. It's much easier to rename your own class to be different from String.
    Big tip: and don't forget to delete your String.class, because if you don't it will continue to trip you up.

  • Incompatible type found

    Gurus,
    I'm getting the following error and hope you could help. It's complaining about code in my AM (in bold). Any ideas?
    Error(281,41): incompatible types; found: oracle.jbo.Row, required: acctmap.oracle.apps.spl.am.server.UserRespVORowImpl
    AM code:
    UserRespVOImpl reqVO = (UserRespVOImpl)findViewObject("Sysadmin");
    if(reqVO!=null)
    Integer userid = new Integer(tx.getUserId());
    reqVO.initUserRespVO(userid);
    reqVO.reset();
    UserRespVORowImpl row = reqVO.next();
    String priv = (String)row.getSysadmin();
    VO code:
    public void initUserRespVO(Integer txUserId)
    setWhereClauseParams(null); //Always reset
    setWhereClauseParam(0,txUserId);
    executeQuery();
    // return Sysadmin;
    }

    Hi Sreese,
    Change your code to ...
    reqVO.reset();
    UserRespVORowImpl row = *(UserRespVORowImpl)* reqVO.next();
    String priv = (String)row.getSysadmin();
    Thanks
    --Anil                                                                                                                                                                                                                                                                                                                                                                   

  • Expected type [NUMBER] found [STRING] (["member"]) in function[operator@div

    Hi,
    I am trying to recalculate a figure based on an annual percentage. The script is
    FIX(yr2011, Plan, CC_4363,draft)
    "AC_&&&&&& Salary" ="AC_&&&&&&Salary"* ("pay increase%"/100)
    endfix
    endexclude
    I receive the error "expected type [NUMBER] found [STRING] (["AC_&&&&&&"]) in function[operator@div"
    I looked at this forum and someone suggested using the @match function. I tried
    "AC_&&&&&& Salary" ="AC_&&&&&& Salary"* (@match(Accounts," pay increase%")/100);
    This validated but the salary figure disappeared.
    The reason I am not loading at monthly (level zero) is due to a business requirement. I am having to spread the figures down the months from the total year but if the total year is wrong or missing the montly data obviously disappears too.
    Thanks,
    Nathan

    A few questions:
    1) I see an ENDEXCLUDE, but no starting EXCLUDE. How does that relate to the code?
    2) Do you really have member names with six ampersands in them? Is that even an allowed character? I guess it is but it looks odd as & is the character used to define the usage of an Essbase Substitution Variable. Okay, that was a comment, not a question, I guess.
    3) Do you have a Pay Increase% in every month? Or is it annual?
    3) Why don't you stick the salary value to be allocated into another Account, e.g., "Annual Salary" and place it in a single month. Then your code could look like:
    FIX(yr2011, Plan, CC_4363,draft, "Jan":"Dec")
    "AC_&&&&&& Salary" ="Annual Salary"->"BegBalance" * ("pay increase%"->"BegBalance" / 100)
    endfix
    I created a BegBalance member which you may not have -- chose Dec or Jan as your home for Annual Salary and Pay Increase and go from there. I also forced the calc to happen at the month level -- I am assuming you have months in your app, but maybe not. Salt to taste.
    Regards,
    Cameron Lackpour

  • Error(86,88): incompatible types; found: java.util.ArrayList

    Hi,
    I'm getting following error :
    Error(86,88): incompatible types; found: java.util.ArrayList, required: com.sun.java.util.collections.ArrayList
    The line JDev is complaining about contains the following code :
    com.sun.java.util.collections.ArrayList runtimeErrors = container.getExceptionsList();
    I really don't have a clue where this error comes from. If I right-click on ArrayList it brings me to the correct declaration.
    Does somebody know what I'm doing wrong?
    Thanks in advance for you help!
    Kris

    Kris,
    try changing the code to :
    java.util.ArrayList runtimeErrors = container.getExceptionsList();apparently container.getExceptionsList() returns a java.util.Arraylist not a com.sun.java.util.collections.ArrayList
    HTH,
    John

  • A newer version of data type BBP_PDS_HSS_IC was found than one required

    Hi,
    When I create a SC, it is automatically approved but the PO is not created.
    If I check TRX SM58 I get the message:
    "A newer version of data type BBP_PDS_HSS_IC was found than one required"
    Any ideas?
    Carlos Durazo

    Hi
    Which SRM version are you using ?
    By an chance have you created any new fields in the standard structure
    <b>'BBP_PDS_HSS_IC'</b> using <u>SE11</u> Transaction in SRM system. Please confirm the same by taking help of ABAP person here. Seems to be like the structure is not Activated completed. 
    <u>Related SAP OSS Notes -></u>
    Note 758067 - SRM 4.0: Change documents of new sets (DynAttr, Weight)
    Note 820201 - Document changes for attachments does not work
    Hinweis 691880 - Changes in tolerances not displayed in purchase order
    Note 1018714 - Change documents: Time stamp of the application server
    Note 1006898 - Deleted vendor not displayed in Change hist of Shopping cart
    Do let me know.
    Regards
    - Atul

  • Incompatible type error

    I am receiving the following errors:
    incompatible types
    found: int
    required: boolean
    if (accessCode = 8345)
    if (accessCode = 55875)
    if (accessCode = 999909)
    I do not understand why I am getting the errors. accessCode is of type int.
    Thanks in advance for any input.
    int accessCode = Integer.parseInt( String.valueOf(
      securityCodeJPasswordField.getPassword() ) );
         int code;
         if (accessCode >= 1645 && accessCode <= 1689)
             code = 1;
         else
         if (accessCode  = 8345)
                code = 2;
         else
         if (accessCode = 55875)
             code = 3;
         else
         if (accessCode = 999898)
             code = 4;
         else
         if (accessCode >= 1000006 && accessCode <= 1000008)
             code = 5;
         else
         if (accessCode < 1000)
             code = 6;
         else
                        code = accessCode;

    Thanks !! I am stuck in the coding syntax that I use in my job: SAS

  • Required:boolean

    I guess I must be stupid but cannot get this to compile
    import java.io.*;
    public class diag_72 {
    public static void main(String[ ] args) throws
    IOException {
    String inputFile ="c:\\java\\image.raw";
    String outputFile = "C:\\java\\new.raw";
    FileInputStream in = new
    FileInputStream(inputFile);
         FileOutputStream out = new
    FileOutputStream(outputFile) ;
    int rws,cl,thresh,vec1 [ ] [ ];
    boolean testbool;
    cl=0;
    vec1=new int[256] [256];
    for (rws=0;rws<256;rws++)
         for(cl=0;cl<256;cl++)
         vec1[rws][cl] = in.read();
         if (rws = = cl)     vec1[rws][cl] = 255;
    out.write(vec1[rws][cl]);
    in.close( );
         out.close( );
    Its supposed to draw a diagonal across a picture
    Generates following error messages
    diag_72.java:22: illegal start of expression
         if (rws = = cl)     vec1[rws][cl] = 255;
    ^
    diag_72.java:22: ')' expected
         if (rws = = cl)     vec1[rws][cl] = 255;
    ^
    diag_72.java:22: incompatible types
    found : int
    required: boolean
         if (rws = = cl)     vec1[rws][cl] = 255;
    I can feel the D'Oh coming on already
    Any help would be appreciated
    ^

    loose the space between the two = and it should work
    if (rws == cl) vec1[rws][cl] = 255;

  • !! help using: public static Boolean valueOf(String s)

    I am trying to use this simple function to convert a string value to a boolean. According to the documentation for this Boolean method (public static Boolean valueOf(String s)), this should work:
    Example: Boolean.valueOf("True") returns true.
    As a test, I tried to run this line of code:
    tmp_bool = Boolean.valueOf("True");
    I get this compilation error:
    test_file.java:10: incompatible types
    found : java.lang.Boolean
    required: boolean
    tmp_bool = Boolean.valueOf("True");
    .....................................^
    According to the documentation for SDK 1.4, there is a new function:
    public static Boolean valueOf(boolean b)
    It seems like the commpiler is focusing on this new version of the valueOf() method, and ignoring the case where a String is the parameter. Why won't it use the version that takes a String? What confuses me even more is that I am running version 1.3.1, and the new valueOf(boolean b) function is not mentioned in its documentation.
    Am I somehow using the method wrong?
    Thanks!

    OK, I think I understand now. Thanks.
    Let me make sure i have this right...
    So basically, if you use variable types of Boolean and need to pass them to methods that take booleans, would you have to call the booleanValue method first?
    ex:
    Boolean bool_obj;
    //example method that takes a boolean
    //test_method(boolean b);
    test_method ( bool_obj.booleanValue() );
    is that right?

  • Incompatible  types

    I get the following error message:
    headoffice.java:181: incompatible types
    found : java.lang.String
    required: int
    switch (sa[3]) //sa[3] contains customer type
    ^
    headoffice.java:183: incompatible types
    found : java.lang.String
    required: int
    case �B�:
    ^
    headoffice.java:186: incompatible types
    found : java.lang.String
    required: int
    case �G�:
    ^
    3 errors
    ...and it is associated with the piece of code below. I do not understand in what way the �G� and �B� are incompatible types with sa[3] which is supposed to hold strings.
    StringTokenizer st=new StringTokenizer(s, �*�);     
    String[] sa=new String[st.countTokens()]; int i=0;          
    while(st.hasMoreTokens())
    sa=st.nextToken();     
    i++;               
    switch (sa[3]) //sa[3] contains customer type
    case �B�:
    BronzeCustomer anotherBronzeCustomer = new BronzeCustomer(sa[0], sa[1]);     break;
    case �G�:
    GoldCustomer anotherGoldCustomer = new GoldCustomer(sa[0], sa[1]);     break;
    default: return;
    // break;     
    What is the problem here?
    Regards
    TJ

    If you are using only 1-character strings, then you can do:
       switch (sa[3].charAt(0)) //sa[3] contains customer type
          case 'B': // ...
          case 'G': // ...
          // etc.
       }

  • Incompatible Types... NOT!

    Why am I getting incompatible types in this method?
    C:\jdk1.3\src\CalcBusinessDays.java:53: incompatible types
    found : java.util.Date
    required: Date
              Date covDate = sdf.parse(dt, pos);^ <-- carat is at end of line
         public Date dateConvert(String dt) {
              SimpleDateFormat sdf = new SimpleDateFormat("mm/dd/yyyy");
              ParsePosition pos = new ParsePosition(0);
              Date covDate = sdf.parse(dt, pos);
              return covDate;
         }     //dateConvert
    Thanks in advance.

    Actually I'm in Hartford, CT, where NJ sends its rain! I used to live in Staten Island which is close to NJ as you know. Also worked in Parsippany for a while.
    I think "Date" needs to be changed to "java.util.Date" in three places. See comments below where changes are marked. I could not compile or test because I don't have Domino / Notes.
    By the way, in case you get similar problems with another class (Calendar?), I believe that the lotus.domino classes are AgentBase, AgentContext, Session and DateTime. The others should be standard Java classes. Good Luck.
    import java.util.*;
    import java.text.*;
    import java.math.*;
    import lotus.domino.*;
    public class CalcBusinessDays extends AgentBase {
        public void NotesMain() {
            DateTime startTime = null, endTime = null;
            String startTimeStr, endTimeStr, result;
            try {
                Session session = getSession();
                AgentContext agentContext = session.getAgentContext();
                startTimeStr = "04/12/2000";
                endTimeStr = "05/04/2000";
                startTime = session.createDateTime(startTimeStr);
                endTime = session.createDateTime(endTimeStr);
                result = diffInWeekdays(startTime, endTime, startTimeStr,
                endTimeStr);
                System.out.println("Result = " + result);
            } catch(Exception e) {
                e.printStackTrace();
        } //NotesMain
        public String diffInWeekdays(DateTime startTime, DateTime endTime, String startTimeStr, String endTimeStr) {
            String res = "";
            try {
                Date firstDate = null, secondDate = null;
                int diffInt = endTime.timeDifference(startTime);
                int diffIntDays = (diffInt / 86400 + 1);
                BigInteger sev = BigInteger.valueOf(7);
                BigInteger minusTwo = BigInteger.valueOf(-2);
                BigInteger bis = BigInteger.valueOf(getWeekday(firstDate = dateConvert(startTimeStr)));
                BigInteger bie = BigInteger.valueOf(getWeekday(secondDate = dateConvert(endTimeStr)));
                int strtDay = bis.mod(sev).intValue();
                int endDay = bie.mod(sev).intValue();
                int max = minusTwo.max(BigInteger.valueOf(strtDay * -1)).intValue();
                int min = BigInteger.valueOf(1).min(bie.mod(sev)).intValue();
                int result = (diffIntDays - endDay + strtDay - 8) * 5 / 7 - max - min + 5 - strtDay + endDay;
                //o.println("result =\t" + result);
                res = Integer.toString(result);
            } catch (Exception e) {
                e.printStackTrace();
            return res;
        } //diffInWeekdays
        public java.util.Date dateConvert(String dt) {          // *** changed
            SimpleDateFormat sdf = new SimpleDateFormat("mm/dd/yyyy");
            ParsePosition pos = new ParsePosition(0);
            java.util.Date covDate = sdf.parse(dt, pos);       // *** changed
            return covDate;
        } //dateConvert
        public int getWeekday(java.util.Date cdt) {            // *** changed
            Calendar cal = Calendar.getInstance();
            cal.setTime(cdt);
            return cal.get(Calendar.DAY_OF_WEEK);
        } //getWeekday
    } //CalcBusinessDays

Maybe you are looking for